I need to deliver a POC very fast, because of that i decided to just throw all my information into 1 index.
Now, when i search, for example, a number with a _all query, i get a very large document.
Is there a way for elastic to highlight on which field the matching occurred?
I look into these docs, doc1doc2
But these solutions only highlights a certain field. in my query i use _all, i dont know which field will hit
Is splitting my index into several indexes \ several types on the same index the only solution?
The short answer is "no", you can't do that with the
_all field. The
_all field is really that: a single field that contains the concatenated contents of all other fields. Once the data from other fields is concatenated into
_all, all information about where it came (or even what kind of data it is, e.g. date vs. number vs. string) is completely lost. It's just a single, big bag of text.
If you need to know what field a query matches, you'll need to maintain multiple fields and search across them. You can do that relatively easily with the
multi_match query, which is designed to search many fields at once.
Then you can use highlighting or query naming in various combinations to achieve what you want.
This probably isn't required, you just need to keep the fields distinct and search them as independent fields, rather than using the
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.