ElasticSearch - create template to match entity by an entity name pattern?


(Mysurf Mail) #1

Lets say I have this template

{
    "template" : "te*",
    "settings" : {
        "number_of_shards" : 1
    },
    "mappings" : {
        "type1" : {
            properties":{"TemplateField":{"enabled": false },.... }
        }
    }
}

It matches indices that match the pattern te*.

I want inside the indice to match only entity type that there name is eqaul to TypeA, TypeB, TypeF

something that will look like

{
    "template" : "te*",
    "settings" : {
        "number_of_shards" : 1
    },
    "mappings" : {
        "typeA, TypeB, TypeC" : {
              properties":{"TemplateField":{"enabled": false },.... }
        }
    }
}

(Mark Walkom) #2

You should be able to do that if you do it per field, or alternatively you can use a dynamic template - https://www.elastic.co/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html#dynamic-templates


(system) #3