Terms aggregation on field with lowercase normalizer

Hi,

I mapped the following field:

"name": {
"type": "keyword",
"normalizer": "lowercase",
"fields": {
"text": {
"type": "text"
}

When I run Terms aggregation on this field, I get lowercase results.

How can I get the source results?

You want results not normalizer?

maybe aggs by other field like:

{
  "name": {
    "type": "keyword",
    "normalizer": "lowercase",
    "fields": {
      "text": {
        "type": "text"
      },
      "raw": {
        "type": "keyword"
      }
    }
  }
}

Correct I want to get the source results not the normalizer (lowercase) results

try aggs by "name.raw"

{
  "size": 0, 
  "aggs": {
    "names": {
      "terms": { "field": "name.raw" }
    }
  }
}

This means the you need to add additional keyword type to the field, I want to avoid it.
The field source is already keyword and I want the aggs will run on it and not on the normalizer.

Anyway, you should change your mapping.
If you want to apply it to the keyword, apply the normalizer to the "text" field.

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