Home > Software engineering >  error in elasticserach while importing single line via json
error in elasticserach while importing single line via json

Time:08-24

ubuntu@ip-172-31-5-121:~$ curl -XPUT localhost:9200/movies -d'

{

    "mapping": {

            "properties": {

                    "year": {

                            "type": "date"

                    }

            }

    }

}'

{"error":{"root_cause":[{"type":"parse_exception","reason":"unknown key [mapping] for create index"}],"type":"parse_exception","reason":"unknown key [mapping] for create index"},"status":400}

CodePudding user response:

Tldr;

Be careful with typos. "mappings" takes an S

To solve

curl -XPUT localhost:9200/movies -d'
{
  "mappings": {
    "properties": {
      "year": {
        "type": "date"
      }
    }
  }
}
'
  • Related