一尘不染

ElasticSearch 5:具有multi_field的MapperParserException

elasticsearch

此映射不适用于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"
                }
            }
        }
    }
}

}

例外是:

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

有人有主意吗?谢谢!;)


阅读 241

收藏
2020-06-22

共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"
                }
            }
        }
    }
  }
}
2020-06-22