elasticsearchelasticsearch-7elasticsearch-mapping

Elasticsearch version 7 cannot be changed from type [keyword] to [text]


I am a newbie of elasticsearch. I create a mapping using such code:

PUT /my-demo1
{
  "mappings": {
    "properties": {
      "dsu_sn": {
        "type": "keyword"
      },
      "iot_id": {
        "type": "keyword"
      },
      "test_suite_id": {
        "type": "text"
      },
      "error_code": {
        "type": "long"
      }
    }
  }
}

ES responses mapper [iot_id] cannot be changed from type [keyword] to [text] when I index a document using such code:

POST /my-demo1/1
{
  "dsu_sn": "ssl123321",
  "iot_id": "550068573720395776",
  "test_suite_id": "com.example.test.wifi",
  "error_code": 2
}

Solution

  • You need to add _doc in URL while posting a document to Elasticsearch, change the URL to POST /my-demo1/_doc/1

    Refer removal of types for more info.