繁体   English   中英

无法使用 postman 生成 elasticsearch 映射

[英]Unable to cerate elasticsearch mapping using postman

我正在使用 docker 运行 elasticsearch 图像。
其他服务运行良好,如创建索引、获取索引列表。
但是当我尝试为已经存在的索引创建映射时,它返回以下错误

{
    "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
}

这是我要创建的映射

{

                "mappings": {
                    "myfile": {
                       "dynamic": "strict",
                        "properties": {
                            "property1":{
                                "type":"keyword"
                            },
                            "property2":{
                                "type":"long"
                            }
                        }

                    }
                }
    }

URL 我正在通过 postman 方法POST http://localhost:9200/my-domain-name/_mapping在我发送上述映射的请求正文中创建映射

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"

我在这里做错了什么?

Elasticsearch 已从 Elasticsearch 7.x 版本中弃用索引的_type

您可以使用 Postamn 的以下请求,它会为您工作。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM