Hi there,
Is there away to rename values within visuals?
so for example filtering Colors which outputs 1 , 2
I want to rename these 1 == 'Red' 2== 'Blue' etc.
Hi there,
Is there away to rename values within visuals?
so for example filtering Colors which outputs 1 , 2
I want to rename these 1 == 'Red' 2== 'Blue' etc.
Though I'm not sure these are only ways, you may use runtime fields to manipulate the values.
Or of cource you may do it outside elasticsearch while indexing.
PUT /test_map
{
"mappings": {
"properties": {
"colorId":{
"type":"keyword"
}
}
}
}
PUT /test_map/_bulk
{"index":{}}
{"colorId":"1"}
{"index":{}}
{"colorId":"2"}
GET /test_map/_search
{
"runtime_mappings": {
"colorName": {
"type": "keyword",
"script": {
"source": """
for (val in doc['colorId']){
emit(params.map[val])
}
""",
"params":{
"map":{
"1": "Red",
"2": "Blue"
}
}
}
}
},
"fields": [
"colorName"
]
}
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.