Quantcast
Viewing latest article 5
Browse Latest Browse All 9

Answer by MAULIK MODI for ElasticSearch - Return Unique Values

I am looking for this kind of solution for my self as well. I found reference in terms aggregation.

So, according to that following is the proper solution.

{"aggs" : {"langs" : {"terms" : { "field" : "language",  "size" : 500 }    }}}

But if you ran into following error:

"error": {"root_cause": [            {"type": "illegal_argument_exception","reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [fastest_method] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."            }        ]}

In that case, you have to add "KEYWORD" in the request, like following:

   {"aggs" : {"langs" : {"terms" : { "field" : "language.keyword",  "size" : 500 }        }    }}

Viewing latest article 5
Browse Latest Browse All 9

Trending Articles