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

.net - Bulk insert via Dapper is slower than inserting rows one-by-one -

shared memory - gstreamer shmsrc and shmsink with h264 data -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -