Add a field, when indexing, with string representation of another integer field

Hi,

I index data that contain a state which is represented as an integer. I would like to translate this number into a string which is easier to remember and search for. What is the recommended way to do this?

Example:
State.Current: 5
I would like to add a field with the string representation:
State.Current.Text: ST_IDLE

Thanks

Is State a nested type field or plain object field?

The data I index look like this:
{
...
"State":{
"Current": 1
}
...
}

But it is indexed as a number with fieldname
State.Current

By data representation it can't be ascertained whether the data type is object or nested. Please show the mapping of your index.

I extracted the relevant part of the mapping:
{
"mapping": {
"doc": {
"properties": {
"data": {
"properties": {
"state": {
"properties": {
"current": {
"type": "long"
},
"previous": {
"type": "long"
}
}
}
}
}
}
}
}
}

Any ideas?

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