2017-10-11 76 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" 
     } 
    } 
    } 
}