Maybe I'm missing something simple, but still could not figure out the following thing:
As of ES 6.x the _all
field is deprecated, and instead it's suggested to use the copy_to
instruction (https://www.elastic.co/guide/en/elasticsearch/reference/current/copy-to.html).
However, I got an impression that you need to explicitly specify the fields which you want to copy to the custom _all
field. But if I use dynamic mappings, I don't know the fields in advance, and therefore cannot use copy_to
?
Any way I can tell ES to copy all encountered fields to the custom _all
field so that I can search across all fields?
Thanks in advance!
You could use Dynamic Templates. Basically create an index, add the custom
catch_all
field and then specify that particular property for all the fields that are strings. (Haven't done this before, but I believe this is the only way now. Since the fieldcatch_all
will be already present when you put the dynamic template, it will not match thecatch_all
- meaning that thecatch_all
will not copy to itself, but check it out yourself to make sure).