October 2019
Beginner
186 pages
5h 39m
English
A query slows as the number of fields it targets increases. To overcome this, it is better to copy the values into a single field at index time, and then search through the field at search time. This process can be automated with the copy-to directive of mappings. In the following example, an index contains the titles and authors of books. The query indexes both values into the same name_and_title field. Please refer to the following example:
PUT books{ "mappings": { "properties": { "name_and_title": { "type": "text" }, "name": { "type": "text", "copy_to": "name_and_title" }, "title": { "type": "text", "copy_to": "name_and_title" } } }}
In the preceding query, we are copying the name and title field into ...
Read now
Unlock full access