elasticsearch - How can I count the number of documents where a field is within a certain range? -
I am trying to create an elastic search query that calculates the number of documents where a certain area This aggregation is within a date histogram aggregation, but I do not think the cases for the purpose of this question.
Example Data:
ID: Score 01: 4 02: 5 03: 10 04: 9 I I want to calculate the number where 'score' is & gt; = 9. I have tried script and filter within it aggregation, but I can not get it to work.
This aggregation counts all documents, not just matches those scripts. {"Field_days": {"date_histogram": {"area": "date", "interval": "day"}, "aggs": {"value_count" : The following grouping gives me a parse failure and said, <"field": "score", "script": "_value" = 9 "}}}}
Code> Failure [required] [POSA], under POS, but [value_count]] in a [VALUE_STRING] :
"aggs": {"report_days": {"Date_histogram": {"area": "date", "interval": "day"}, "ags": {"value_count": {"field": "score", "filter": {"ra nge" : {"Score": {"gte": 9}}}}}} any suggestions Thank you!
Run the query ("Score:> 9") and hit-> Check the total value in examples.
Comments
Post a Comment