【问题标题】:ElasticSearch 5: MapperParserException with multi_fieldElasticSearch 5:带有 multi_field 的 MapperParserException
【发布时间】:2017-03-11 02:36:59
【问题描述】:

此映射在 ES 2.X 中有效,现在在 ES 5 中出现异常:

{  
"type1":{  
    "properties":{  
        "name":{  
            "type":"multi_field",
            "fields":{  
                "name":{  
                    "type":"string",
                    "index_analyzer":"standard",
                    "index":"analyzed",
                    "store":"no",
                    "search_analyzer":"standard"
                },
                "name_autocomplete":{  
                    "type":"string",
                    "index_analyzer":"autocomplete",
                    "index":"analyzed",
                    "store":"no",
                    "search_analyzer":"standard"
                }
            }
        }
    }
}

}

例外是:

没有在字段 [name] 上声明的类型 [multi_field] 的处理程序

有人有想法吗?谢谢! ;)

【问题讨论】:

    标签: java elasticsearch mapping


    【解决方案1】:

    multi-field 在 ES 1.x 中已被弃用,并在 ES 5.x 中完全删除。

    现在可以通过使用 fields 来支持多字段,您可以像这样指定:

    {  
      "type1":{  
        "properties":{  
            "name":{  
                "type":"text",
                "analyzer":"standard",
                "index":"analyzed",
                "store":"no",
                "search_analyzer":"standard"
                "fields": {
                    "autocomplete":{  
                        "type":"text",
                        "analyzer":"autocomplete",
                        "index":"analyzed",
                        "store":"no",
                        "search_analyzer":"standard"
                    }
                }
            }
        }
      }
    }
    

    【讨论】:

    • 如何在其中插入文档?像这样? PUT index/type1/1 { "name" : { "autocomplete": "Jose Sebastian" } }
    • @sheldon_cooper 你可能应该问另一个问题,因为它看起来不相关。
    • @Val 在映射如上时插入数据也有问题。这是我打开的问题的link。查看您的上述建议,我已经更新了我的映射。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-02-06
    • 2016-03-21
    • 1970-01-01
    • 1970-01-01
    • 2017-02-16
    • 2016-03-12
    • 2018-01-23
    相关资源
    最近更新 更多