gpt4 book ai didi

post - Elasticsearch创建索引错误

转载 作者:行者123 更新时间:2023-12-03 01:49:44 24 4
gpt4 key购买 nike

我是Elasticsearch的新手,使用ES 5.1.1,我试图创建以下简单索引:

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]

最佳答案

从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"
}
}
}
}
}'

关于post - Elasticsearch创建索引错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41439541/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com