Hey @charlz, welcome to the discussion boards!
Kibana can't translate your user-supplied data on its own, but you can accomplish this with data enrichment when you ingest the data into Elasticsearch.
There are a couple of high-level steps:
Define an enrichment index
This index will be a mapping between your status id, and the various translations you're interested in. I chose English and Spanish, but you can do whatever you'd like. Here is an example of the three status codes you provided, being created in the enrich_status
index:
POST enrich_status/_doc
{
"status": 1,
"status_en": "WON",
"status_es": "GANAR"
}
POST enrich_status/_doc
{
"status": 2,
"status_en": "REJECTED",
"status_es": "RECHAZADA"
}
POST enrich_status/_doc
{
"status": 3,
"status_en": "CANCELED",
"status_es": "CANCELADA"
}
Create an enrichment policy
I followed this example to create a policy to match based on the status
field:
PUT /_enrich/policy/status-policy
{
"match": {
"indices": "enrich_status",
"match_field": "status",
"enrich_fields": ["status_en", "status_es"]
}
}
POST /_enrich/policy/status-policy/_execute
PUT /_ingest/pipeline/status_lookup
{
"description" : "Enriching status details",
"processors" : [
{
"enrich" : {
"policy_name": "status-policy",
"field" : "status",
"target_field": "details",
"max_matches": "1"
}
}
]
}
Ingest your data
Now, when you index data into Elasticsearch, specify the status_lookup
pipeline:
PUT /my_charlz_index/_doc/my_id?pipeline=status_lookup
{
"status": 1
}
Then, when you search this index, you'll find that all the relevant details from the enrich_status
index have been copied into your target index:
GET /my_charlz_index/_search
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "my_charlz_index",
"_type" : "_doc",
"_id" : "my_id",
"_score" : 1.0,
"_source" : {
"details" : {
"status_es" : "GANAR",
"status_en" : "WON",
"status" : 1
},
"status" : 1
}
}
]
}
}