简体   繁体   English

无法使用 postman 生成 elasticsearch 映射

[英]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.

相关问题 Postman:使用 Postman 读取放置在 aws 中的 csv 文件? - Postman: Read a csv file placed in aws using Postman? 如何在速度模板(AWS appsync + elasticsearch)中使用字符串替换? - How to using String replace in velocity template (AWS appsync + elasticsearch)? 使用 postman 在 sendgrid v3 正文中发送动态变量 - Sending dynamic variables in sendgrid v3 body using postman GORM 无法使用.Find() 查询所有记录 - GORM unable to query all records using .Find() 无法使用 html 从 firebase 读取数据 - unable to read data from firebase using html 无法使用 Fuse 在 GCP buket 中写入文件 - Unable to write files in a GCP buket using Fuse 无法使用 Meson 使用 MKL 安装 Scipy - Unable to install Scipy with MKL using Meson 无法使用 Jenkins 将 docker 映像部署到 GKE - Unable to deploy docker image to GKE using Jenkins Nodejs Post 请求在 Postman 中不起作用? - Nodejs Post request is not working in Postman? How to Authenticate with Firebase realtime database using UID or Email and Password for REST API using postman - How to Authenticate with Firebase realtime database using UID or Email and Password for REST API using postman
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM