I have the following mapping in elasticsearch:
{
"doc": {
"properties": {
"fileContent": {
"properties": {
"dimension": {
"properties": {
"jurisdiction": {
"type": "string"
},
"language": {
"type": "string"
},
"region": {
"type": "string"
},
"trueValue": {
"type": "string"
}
}
},
"dynamicGeneratedProperty1": {},
"dynamicGeneratedProperty2": {},
"dynamicGeneratedPropertyN": {}
}
}
}
}
}
I'm trying to configure elasticsearch to index only the dimension property from the fileContent, but the other properties, that are generated dynamically, I don't want to be indexed.
I have tried the following config, but it doesn't seem to work properly:
curl -XPUT 0:9200/river1/doc/_mapping -d '
{
"doc": {
"properties": {
"fileContent": {
"type": "object",
"store": true,
"enabled": false,
"properties": {
"dimension": {
"type": "object",
"store": true,
"enabled": true
}
}
}
}
}
}
'
It applies the "enabled": false config from the parent property, that is fileContent, and it ignores the sub-property config, that tells to index the dimension.
I know that there is also some template config, on which you tell elastic to index properties based on a defined-template, in which you can specify some sort of regex: https://www.elastic.co/guide/en/elasticsearch/reference/0.90/indices-templates.html. But I don't know how to use it exactly.
I am using a quite old version of elasticsearch, 0.93.