Elastic Search aggregation query results are case incentive

I am using Elasticsearch 6.2 Version. In the aggregation, query results are returned like `

Apple 10, apple 20, aPple 30

But I need all the names to be lower case and the final count will be

apple 60

Is there any way to get the aggregation results like my requirement.

Use a lowercase normalizer on your keyword field.

This is mappings file:
"company_name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
},
},
"boost": 1.0,
"analyzer": "lowercase_analyzer",
},

Have a look at https://www.elastic.co/guide/en/elasticsearch/reference/current/normalizer.html

@dadoonet It is working fine. Thank you!

In my case, I am having some special characters also like below:

Token - count
apple, inc - 20
apple inc - 10
apple inc, - 10
apple. inc - 20
apple.inc., - 10

I need the output like this:

Token - count
apple inc - 70

Is there any analyzer to satisfy my condition? If yes, Can you point me? Thank you!

@dadoonet Got it. Just used custom analyzer and used that analyzer in normalize function.

"dot_pattern": {
"type": "pattern_replace",
"pattern": "\.",
"replacement": " "
}

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