elastic-builder: how to retrieve all unique value of one specific field

Issue

I am completely new using elastic search with current project(elastic-builder is used) and documentation of elastic-builder is bit confusing.
I need to retrieve all unique values of one specific field, say creator of tasks stored on server, how should I compose the query to achieve this?

Solution

You can use the terms aggregation to get all the unique values sorted by count from a field. If you use the default mapping for your index, your creator field should have a subfield creator.keyword that you can use for the terms aggregation.

Answered By – samy

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published