So,
I have been using the old multi_field type when creating template such as below.
"field_a":
{
"type": "multi_field",
"fields":
{
"searchable": {
"index": "analyzed",
"type": "string"
},
"field_a": {
"index": "not_analyzed",
"type": "string"
}
}
}
This works fine, when querying I can just do a terms aggregation on the "field_a" instead of having to remember to put the "field_a.raw" or something similar.
However, when I change this to the new syntax of just using the fields element this no longer works. When I do the terms aggregation using the below template the terms are split and not bringing the original value. So if the field had the value "testing a field" I would expect it to return "testing a field" as one term and not "testing", "a", "field" as individual terms. Note this is what is returned using the original template.
"field_a":
{
"type": "string",
"fields":
{
"searchable": {
"index": "analyzed",
"type": "string"
},
"field_a": {
"index": "not_analyzed",
"type": "string"
}
}
}
I have tried moving the "index": "not_analyzed" into the initial field mapping, just under "type" however this gives me an error, "illegal field [index], only fields can be specified inside fields", when trying to index documents.
So my question is, is there a way I can make the initial field not_analyzed and then have an additional field which is searchable? Or do I have to change everything to include two separate field one with raw and one searchable seems a bit strange how this worked before mind you.
I am using
NEST: 1.7.2 ES: 1.5.2