Getting /Visualizing the frequency distribution of the scores of all the matching documents

Hi

I would like to display the frequency distribution of the scores of all the matching documents from a query.

for instance if I execute the query A, I would like to get a frequency distribution like:

  • 10 documents have a score between [0 - 10]
  • 20 documents have a score between [11 - 20]
  • 5 documents have a score between [21 - 30]

=> How to post aggregate the resulting scores of the matching documents of a query ?

Thanks !

Try this:

GET /my_index/_search
{
  "query": {
	"query_string": {
	  "query": "myquery"
	}
  },
  "aggs": {
	"score_ranges": {
	  "histogram": {
		"script":{
		  "inline":"_score"
		},
		"interval": 10
	  }
	}
  }
}

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