我第一次尝试运行elasticsearch。 http://localhost:9200返回正确的响应。现在我正在尝试通过 postman 使用以下文件创建自己的映射:
[POST] 本地主机:9200/人
{
"mappings" : {
"person":{
"properties": {
"personid":{
"type": "integer"
},
"name":{
"type": "string"
},
"email":{
"type": "string"
}
}
}
}
}
但是每当我发布它时,我都会得到以下信息
{
"error": "Incorrect HTTP method for uri [/persons/] and method [POST], allowed: [GET, DELETE, PUT, HEAD]",
"status": 405
}
我在这里做错了什么?
最佳答案
To add mapping in elastic search always use PUT method
PUT localhost:9200/index_name/_mapping
{
"mappings" : {
"person":{
"properties": {
"personid":{
"type": "integer"
},
"name":{
"type": "string"
},
"email":{
"type": "string"
}
}
}
}
}
关于ubuntu - 无法在 Elasticsearch 中创建映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58556949/