ubuntu - 无法在 Elasticsearch 中创建映射

标签 ubuntu elasticsearch

我第一次尝试运行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/

相关文章:

php - 如何在 ubuntu 12.04 中更改 mysql 数据目录

linux - 使用 CentOS 6 作为 docker 容器的 Ubuntu 主机,如何访问 iptables?

c# - Elasticsearch-按分数过滤前N个文档,然后按字段排序

javascript - Meteor JS 中的搜索工具

ubuntu - 由于未安装内核驱动程序,无法在虚拟机上启动 guest 操作系统

ubuntu - nginx上的多个网络核心应用程序同一个域

Elasticsearch 仅获取那些桶大小大于给定数字的日期直方图

elasticsearch - 在ES 2.3中我在哪里设置index.merge.scheduler.max_thread_count?

python - 如何恢复到原始的 Ubuntu Python 安装?

hibernate - Elasticsearch 的性能是否会受到关系数据库模型(如MySQL)的影响?