java - Term Aggregation ElasticSearch -


i want group status field fetching elasticsearch through java api. below code

searchrequest request =     requests.searchrequest(constantsvalue.indexname)     .types(constantsvalue._type)     .source("{\"_source\" : [\"status\"],\"aggs\": {\"group_by_status\": {\"terms\": {\"field\": \"status\"}}}}");          searchresponse response = client.search(request).actionget();         (searchhit hit : response.gethits())          {                     system.out.println("value  :"+hit.sourceasstring());         } 

but shows status value in result. output getting is

value  :{"status":"success"} value  :{"status":"success"} value  :{"status":"error"} value  :{"status":"error"} value  :{"status":"error"} value  :{"status":"waiting"} value  :{"status":"waiting"} value  :{"status":"error"} value  :{"status":"waiting"} value  :{"status":"success"} 

i want each status once can apply further queries. have tried best can't it. if fetch unique value, me find more attributes. please me in this.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -