2017-01-03 107 views
0

我是很新的Elasticsearch.Using ES 5.1.1,我試圖創建下面的簡單指標:Elasticsearch創建索引錯誤出

curl -XPOST "http://localhost:9200/user" -d' 
{ 
    "mappings": { 
    "post": { 
     "properties": { 
     "first_name": { 
      "type": "string" 
     }, 
     "last_name": { 
      "type": "string" 
     }, 
     "birth_date": { 
      "type": "date" 
     } 
     } 
    } 
    } 
}' 

但我得到一個HTTP 400以下錯誤消息:

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

回答

1

由於ES 5,你must use PUT而不是POST創建新的索引時:

curl -XPUT "http://localhost:9200/user" -d' 
{ 
    "mappings": { 
    "post": { 
     "properties": { 
     "first_name": { 
      "type": "string" 
     }, 
     "last_name": { 
      "type": "string" 
     }, 
     "birth_date": { 
      "type": "date" 
     } 
     } 
    } 
    } 
}' 
+0

那是的,非常感謝你的及時回覆! –

+0

很高興幫助! – Val