I am trying to fetch data using elastic search with java using method .addAggregation(terms(term))
The JSON response that I am expecting is { "key" : "TEST" }
but I am getting the response as { "key" : "test" } which is in lower case, I want the response to be as it is stored. Please help here
The reason is that
keyis being analyzed e.g. lower-cased.What you could do is have a "searchable" field that is being tokenized, but aggregate on a display field that preserves the casing. Or if you only want to aggregate (or if your search is case-sensitive and it seems for a field like
keytokenization is also not desired) use thekeywordtype (https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html)