zhangzheny 2018-01-23 10:20 采纳率: 33.3%
浏览 17565
已采纳

elasticsearch 设置mapping时出错

在使用官方文档案例
PUT /my_store
{
"mappings" : {
"products" : {
"properties" : {
"productID" : {
"type" : "string",
"index":"not_analyzed"
}
}
}
}
}
时报错:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "No handler for type [string] declared on field [productID]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [products]: No handler for type [string] declared on field [productID]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "No handler for type [string] declared on field [productID]"
}
},
"status": 400
}

  • 写回答

5条回答 默认 最新

  • paditang 2018-01-24 01:31
    关注

    看你下载的ES是哪个版本,5.x以上已经没有string类型。如果需要分词的话使用text,不需要分词使用keyword。
    具体可以参考这篇博文:http://blog.csdn.net/paditang/article/details/78949233
    另:官方中文文档比较滞后,建议查看英文文档

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?