Term aggregation not returning all unique values

Hi ,

I am using Term Aggregations to get unique values for fields to show them as filters. however I am not getting all the results from ES.
code .
GET /_search { "aggs" : { "genres" : { "terms" : { "field" : "TEST_CountryArray.keyword" } } } }
China Andorra Germany Algeria Brazil Afghanistan Angola Australia Austria Cyprus

but I know that I have job with UK(in capital lettlers, not sure if thats an issue) in countries list which is inserted to ES later point of time.
`GET jobs/_search


PFB for query result.
in terms query...

..in Terms aggregation

can someone explain what could be the issue, and need any additional info.


Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

Thanks @dadoonet for the response. I am using NEST client from Dotnet to interact with ES and not much familiar with direct ES queries(I have posted the request output given by NEST). Can I share Nest code to get more details on this.

You can but I won't be able to help then.
Just open Kibana dev console and try to reproduce your problem without Nest and then we can see what is going wrong, how to fix, which you'll be able to translate to nest.

Hey @dadoonet..I just updated with full query information and screenshots from Kibana..can you please have a look and see where I am doing wrong.

By default you only get the top 10 terms (and the UK is not in that top ten).
Set the terms agg size parameter to a larger number to see more

Yeah. That really helped @Mark_Harwood. I was using global size parameter(size to specify docs count) that returns documents not terms. I just used size parameter for term it worked perfectly.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.