1
votes

I am able to search normal query . Contains fields value or sorting from elasticsearch uri search but unable to run the term aggregation queries from uri search.

How i can do this?

Term aggregation query is :

curl -u elastic -XGET '127.0.0.1:9200/indexname/typename/_search?pretty' -d'{"size": 0,"aggs": {"group_by_field": {"terms": {"field": "txt_field_name","size": 10},"aggs": {"maxDate": {"max":{"field": "dat_field_name"}}}}}}'

Can we do term aggregation queries from URI Search?

1

1 Answers

4
votes

What if you have your URI query as such:

curl -u elastic -XGET 'localhost:9200/indexname/typename/_search?source={"aggs":{"maxDate":{"terms":{"field":"dat_field_name"}}}}'