Elastic search .json file upload Error "illegal_argument_exception"

18 Views Asked by At

I am trying to upload a json file to an existing index in elastic search, the index mapping looks like this: mapping. and i am uploading a json file containing data in this form: json file data sample. I am getting the following "illegal_argument_exception" when uploading the file from cmd:

curl --insecure --cacert "path to cert" -u elastic: -X POST "https://localhost:9200/search-test2/_doc?pretty" -H "Content-Type:application/json" -d@C:/users/s/downloads/file-coderstool.json

"type" : "illegal_argument_exception", "reason" : "mapper [ctRoot.score] cannot be changed from type [long] to [float]"

i have tried to post the data from the dev console in kibana to make sure the data is structured correctly and it worked fine. i have tried creating a new index and changing the mapping to long or double or scaled float whit scalling factor 10 all tries ended with same error. any suggestions why i am getting this error?

1

There are 1 best solutions below

0
Musab Dogan On

You can create a new index with ctRoot.score field type float.

PUT index_name
{
  "mappings": {
    "properties": {
      "ctRoot.score": {
        "type": "float"
      }
    }
  }
}