Manjusha S
Manjusha S

Reputation: 29

copy contents from sample json file to index elastic search index json file

elastic search version i am using 6.6.1

i have created index by running following command curl -XPUT http://localhost:9200/incident_422? -H 'Content-Type: application/json' -d @elasticsearch.json

i need to update the index file with sample json data.(sample.json)

{
    "properties": {
        "id185": {
            "type": "byte"
    },
    "id255": {
      "type": "text"
    },
    "id388": {
      "type": "text"
      }
    }
  }

I tried running the command curl -XPUT http://localhost:9200/incident_422/mapping/_doc? -H 'Content-Type: application/json' -d @sample.json

but i get the error message saying that {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Rejecting mapping update to [incident_422] as the final mapping would have more than 1 type: [mapping, doc]"}]

i have read somewhere that ELK 6 doesnt support more than two types.

Could anyone please tell me how this can be achieved without downgrading the version

Upvotes: 1

Views: 306

Answers (1)

Amit
Amit

Reputation: 32386

This seems to related to the removal of mapping type, you need to specify the type name while indexing the documents.

try adding type to your index request aka http://localhost:9200/incident_422/<your-type-name> in your URL and it should solve the issue.

Upvotes: 0

Related Questions