Total count of matched phrase in each result document


(satyaveer singh) #1

Hi everyone,

Thanks for the great software!
I have a query about total hit count across multiple documents, where one document can have more than 1 hit for my search term.
So let's say my search term is "information", and the word exists 50 times in 27 documents in multiple fields ( covered in my search query ).
Now how do I get this number, which is '50' in my example above?


(David Pilato) #2

The first thing that came to my mind is https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-valuecount-aggregation.html but it will work only on keyword fields if you run first a terms agg and valuecount sub agg I guess.

But then I realized that you might be able to find this information by using "explain": true in your query. Although I don't recommend using that in production as it would slowdown the search.


(manas) #3

Satyaveer, did you get a solution to your problem ? Am also searching for the same, I wonder even is it possible using Elasticsearch, because I can't see a proper solution for that by anyone !

Please, reply me if you found a way how to do it !!

Thanks.


(system) #4

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