How to get the most relevant fields from a single document?

I have an index containing documents with information about various products. As the documents were created from paginated files, the information text is mapped on numerated fields representing the respective page in the file. Here is an example of such a document:



POST technical_documentations_1/_doc/
{
  "Name": "Battery1",
  "1":"heat conduction temperature max. heat electrity",
  "2":"material heat",
  "3":"min. temperature heat conduction temperature max. heat electrity",
  "4":"failure temperature electricity"
}

Now I would like to query the document for keywords and as a result receive the fields which contain the highest count ouf keywords. As an example a query for the keywords ["temperature","heat"] should return "3" as a result, because this field/page has the highest count of these words in total. Is such a query doable in Elasticsearch?

An alternative would be to create a document of its own for the content of each page and then have something like a compound query to select on the "Name"-field and then calculate the score among the retrieved documents on a common "content"-field, which stores the actual information found on the page as text. However, as there are multiple files with technical documentations, this appears to be rather cumbersome and inefficient as I would have to index every page in a single document.

Is there a way to simply query one single document using several search terms and just receive the most relevant field(s) within that document?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.