I have an index mapping with two string fields, field1and field2both are declared as copy_to in another field called all_fields. all_fieldsindexed as "not_analyzed".
When I create the bucket on all_fields, I was expecting great buckets with the field1 and field2 keys combined together. Instead, I get separate buckets with the keys field1 and field2 not concatenated.
Example: display:
{
"mappings": {
"myobject": {
"properties": {
"field1": {
"type": "string",
"index": "analyzed",
"copy_to": "all_fields"
},
"field2": {
"type": "string",
"index": "analyzed",
"copy_to": "all_fields"
},
"all_fields": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
data:
{
"field1": "dinner carrot potato broccoli",
"field2": "something here",
}
and
{
"field1": "fish chicken something",
"field2": "dinner",
}
aggregation:
{
"aggs": {
"t": {
"terms": {
"field": "all_fields"
}
}
}
}
results:
...
"aggregations": {
"t": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "dinner",
"doc_count": 1
},
{
"key": "dinner carrot potato broccoli",
"doc_count": 1
},
{
"key": "fish chicken something",
"doc_count": 1
},
{
"key": "something here",
"doc_count": 1
}
]
}
}
I was expecting only 2 buckets, fish chicken somethingdinneranddinner carrot potato broccolisomethinghere
What am I doing wrong?