2017-10-11 71 views
0

嗨索引我已经使用弹性1.6版之前,做了如下指标映射,无法映射弹性5.6

//jarSetup.json

mappings": { 
"jardata": { 
    "properties": { 
    "groupID": { 
     "index": "not_analyzed", 
     "type": "string" 
     }, 
    "artifactID": { 
    "index": "not_analyzed", 
    "type": "string" 
     }, 
     "directory": { 
     "type": "string" 
     }, 
     "jarFileName": { 
     "index": "not_analyzed", 
     "type": "string" 
     }, 
     "version": { 
     "index": "not_analyzed", 
     "type": "string" 
     } 
    } 
    } 
} 

我运行命令curl -XPOST http://localhost:9200/testjar -d @jarSetup.json到做映射。它在弹性版本1.6中运行良好。但是当我在5.6版中尝试完全一样的东西时,它给了我一个错误

No handler found for uri [/testjardata] and method [POST] 

我找不出什么问题。如果有人对此有所了解,请帮助我。

回答

1

您创建一个索引

curl -XPUT http://localhost:9200/testjar -d @jarSetup.json 

而且当需要使用PUT方法,分析了现在的字符串字段被称为text,而不是分析串字段被称为keyword,让你的jarSetup.json文件应该是这样的,而不是:

mappings": { 
"jardata": { 
    "properties": { 
    "groupID": { 
     "type": "keyword" 
     }, 
    "artifactID": { 
    "type": "keyword" 
     }, 
     "directory": { 
     "type": "text" 
     }, 
     "jarFileName": { 
     "type": "keyword" 
     }, 
     "version": { 
     "type": "keyword" 
     } 
    } 
    } 
}