Can't post data

Hi there.
I have started to use elasticesearch nowadays.
then,
at first i would like to post data by curl command by following this page.
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
But i can't.
my index is here.

$ curl -H "Content-Type: application/json" -XGET 'http://localhost:9200/shakespeare?pretty'
{
  "shakespeare" : {
    "aliases" : { },
    "mappings" : {
      "shakespeare" : {
        "properties" : {
          "line_id" : {
            "type" : "integer"
          },
          "play_name" : {
            "type" : "text"
          },
          "speaker" : {
            "type" : "text"
          },
          "speech_number" : {
            "type" : "integer"
          }
        }
      }
    },
    "settings" : {
      "index" : {
        "creation_date" : "1520341215833",
        "number_of_shards" : "5",
        "number_of_replicas" : "1",
        "uuid" : "rsu73dnpTPWCro8gBoKdtA",
        "version" : {
          "created" : "6020299"
        },
        "provided_name" : "shakespeare"
      }
    }
  }
}

error message is here.

$ curl -XPOST 'localhost:9200/_bulk?pretty' -H 'Content-Type: application/json' -d'
quote> { "index" : { "_index" : "shakespeare", "_type" : "_doc", "_id" : "1" } }
quote> {"line_id":1,"play_name":"Henry IV","speech_number":0,"speaker":"hiratsuka"}
quote> { "index" : { "_index" : "shakespeare", "_type" : "_doc", "_id" : "2" } }
quote> {"line_id":1,"play_name":"test IV","speech_number":0,"speaker":"test"}
quote> '
{
  "took" : 204,
  "errors" : true,
  "items" : [
    {
      "index" : {
        "_index" : "shakespeare",
        "_type" : "_doc",
        "_id" : "1",
        "status" : 400,
        "error" : {
          "type" : "illegal_argument_exception",
          "reason" : "Rejecting mapping update to [shakespeare] as the final mapping would have more than 1 type: [_doc, shakespeare]"
        }
      }
    },
    {
      "index" : {
        "_index" : "shakespeare",
        "_type" : "_doc",
        "_id" : "2",
        "status" : 400,
        "error" : {
          "type" : "illegal_argument_exception",
          "reason" : "Rejecting mapping update to [shakespeare] as the final mapping would have more than 1 type: [_doc, shakespeare]"
        }
      }
    }
  ]
}

What is this problem?

You need to delete the index/mapping change that shakespeare to _doc and you should be ok.

You said that i should re-create index from begining,right?

Correct.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.