I am indexing PDF documents in elasticsearch without using the official plugin, I am using a PHP library to parse PDF content into plain text. This PHP library allows me to get the document content by pages so I would like my search page would retrieve some highlight similar to:
[Page 1] ... Highlighted text from the search ... [Page 4] ... Highlighted text from page 4 that match with the search ...
The mapping they gave to me is like this, I just converted text from string to array:
properties: {
highlight:{
text: [ "Page1Content...", "Page2Content...", "Page3Content...", ...],
other_fields: {}
},
other_fields: {}
}
But I caot find a way to get the array indexes when getting the highlighted content, it get lost in the way.
Are nested / objects the only way to know the page number when I search? I don't know if array keys are lost when highlighting too. I thought in something like or similar:
highlight : {
text: {
"Page1" : "Page1Content",
"Page2": "Page2Content",
....
},
other_fields: {}
}
Thanks in advance.
