Riz
Riz

Reputation: 1065

Make all objects in elastic search nested objects

Is it possible to make all nested objects in elastic search automatically map to the type nested by default. Instead of object?

Upvotes: 3

Views: 530

Answers (1)

Val
Val

Reputation: 217334

Yes, you can do it by using the following dynamic template when creating your index:

PUT my_index
{
  "mappings": {
    "my_type": {
      "dynamic_templates": [
        {
          "nested": {
            "match_mapping_type": "object",
            "mapping": {
              "type": "nested"
            }
          }
        }
      ]
    }
  }
}

Upvotes: 5

Related Questions