Hi,
i have the field “currency” with the following mapping configuration:
"currency" : {
"type" : "keyword",
"normalizer": "lowercase"
},
I need to aggregate the currency value, but case sensitive.
When i use the following query, the aggregation is case INsensitive:
GET index/_search
{
"aggs": {
"date": {
"date_histogram": {
"field": "created_at",
"interval": "day"
},
"aggs": {
"string": {
"terms": {
"size": 5000,
"script": {
"source": "(doc['currency'].size() == 0 ? '' : doc['currency'].value)",
"lang": "painless"
}
}
}
}
}
}
}
Using params._source['currency']
instead of doc['currency'].value
, the query is VERY SLOW.
What’s the best way to solve this issue?