使所有对象都在弹性搜索中嵌套对象 [英] Make all objects in elastic search nested objects

查看:52
本文介绍了使所有对象都在弹性搜索中嵌套对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使弹性搜索中的所有嵌套对象自动映射为默认嵌套的类型.而不是物体?

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

推荐答案

是的,您可以使用以下

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"
            }
          }
        }
      ]
    }
  }
}

这篇关于使所有对象都在弹性搜索中嵌套对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆