Adding payload and retrieve them in highlighting

(Karol Sikora) #1


My simplified use case is to search in pages of book and show back to user
on which pages search phrase was found.
First think about such case was to denormalize pages structure into fields
in book, eg page_1, page_2, .... The important thing is that i need to
return back on which page we found phrase occurence.
This approach fails, because i need to search in content fields, but
querying and highlighting i fields named page_* is impossible.
I was also thinked about storing pages in nested structures, but it also
fails because i cannot get back information about page in highlighting.
Tested strucuture looked as following:
pages: [ {'name': 1, 'content': 'lorem ipsum'}, ...] (inner objects)
pages: {1: 'lorem ipsum', ...}, (nested objects)
Both above also fails.

The way that i'm thinking is to store payload(page numner) with content
attribute, so indexing structure as inner objects will be theoretically
able to return page number with higlighting response.

Im asking here for advice more advanced users. As far as i know storing
payloads and returing them in highlight response is currently not possible,
but i can try to develop support for such feature.
But, maybe there is an easier way that i'm missing now.


You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit

(system) #2