[英]Unable to cerate elasticsearch mapping using postman
I'm running elasticsearch image using docker.我正在使用 docker 运行 elasticsearch 图像。
Other services are running fine, like creating index, getting list of indices index.其他服务运行良好,如创建索引、获取索引列表。
But when i try to create mappings for already existing indices it returns the following error但是当我尝试为已经存在的索引创建映射时,它返回以下错误
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: mappings definition"
}
],
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters:mappings definition "
},
"status": 400
}
This is the mapping i'm trying to create这是我要创建的映射
{
"mappings": {
"myfile": {
"dynamic": "strict",
"properties": {
"property1":{
"type":"keyword"
},
"property2":{
"type":"long"
}
}
}
}
}
URL i'm using to create mappings through postman Method POST
http://localhost:9200/my-domain-name/_mapping
in the body of the request i'm sending above mappings URL 我正在通过 postman 方法
POST
http://localhost:9200/my-domain-name/_mapping
在我发送上述映射的请求正文中创建映射
Elasticsearch image for docker is Elasticsearch docker 的图像是
elasticsearch:
container_name: tqd-elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:7.0.1
environment:
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- discovery.type=single-node
depends_on:
- "localstack"
logging:
driver: none
ports:
- 9300:9300
- 9200:9200
networks:
- "local"
networks:
local:
driver: "bridge"
What am I doing wrong over here?我在这里做错了什么?
Elasticsearch has deprecated _type
of index from Elasticsearch 7.x version. Elasticsearch 已从 Elasticsearch 7.x 版本中弃用索引的
_type
。
You can use below request from Postamn and it will work for you.您可以使用 Postamn 的以下请求,它会为您工作。
URL: POST http://localhost:9200/my-domain-name/_mapping URL: POST http://localhost:9200/my-domain-name/_mapping
{
"dynamic": "strict",
"properties": {
"property1": {
"type": "keyword"
},
"property2": {
"type": "long"
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.