Elastic Search Aggregation Based On Case Insensitive

Hi Team,

I have requirement I need to fetch data in Elasticsearch case insensitivity, but need on both key and value field.

Sample code below

POST test-index999/_doc
{
  "key": "testKey:testValue",
  "count": 200,
  "id": "test123"
}

Another document

POST test-index999/_doc
{
  "key": "testKey:testValue",
  "count": 100,
  "id": "test123"
}

Expected Output

GET test-index999/_search
{
  "query": {
    "match": {
      "id": "test123"
    }
  },
 "aggs": {
     "byCat": {
        "terms": {
            "field": "key"
         }
      }
  }
}

Can I get below output

"aggregations": {
     "byCat": {
        "key": "testkey:testvalue",
        "count": 300
     }
}

Welcome!

Your post is incomplete. Could you do it again?