Norah Jones
Norah Jones

Reputation: 467

Mapping definition for [data] has unsupported parameters

I am trying to use this command to initiate mapping. It seem fine for me.

curl -X PUT "localhost:9200/data?pretty" -H 'Content-Type: application/json' -d
'{
  "settings":{
     "number_of_shards":"1",
     "number_of_replicas":"1"
  },
  "mappings":{
     "properties":{
        "data":{
           "type":"nested",
           "properties":{
              "title":{
                 "type":"text"
              },
              "sources":{
                 "type":"keyword"
              },
              "flags":{
                 "type":"keyword",
                 "null_value":"NULL"
              }
           },
           "steps":{
              "type":"nested",
              "properties":{
                 "time": {
                   "type": "keyword"
                  },
                 "products":{
                    "type":"nested",
                    "properties":{
                       "name":{
                          "type":"text"
                       },
                       "link":{
                          "type":"keyword",
                          "null_value":"NULL"
                       },
                       "type":{
                          "type":"keyword",
                          "null_value":"NULL"
                       },
                       "ingredients":{
                          "type":"keyword",
                          "null_value":"NULL"
                       },
                       "flags":{
                          "type":"keyword",
                          "null_value":"NULL"
                       }
                    }
                 }
              }
           }
        }
     }
  }
}'


However, it's throwing this error:

        "type" : "mapper_parsing_exception",
        "reason" : "Mapping definition for [routines] has unsupported parameters:  [steps : {type=nested, properties={time=keyword, products={type=nested, properties={name={type=text}, link={null_value=NULL, type=keyword}, flags={null_value=NULL, type=keyword}, ingredients={null_value=NULL, type=keyword}, type={null_value=NULL, type=keyword}}}}}]"

Could you please show me what's wrong with this mapping? Steps contains array of objects so it should be type:nested I believe. Also, I checked the json parsing and it's good.

Upvotes: 0

Views: 605

Answers (1)

Val
Val

Reputation: 217304

This doesn't look right:

       "steps":{
          "type":"nested",
          "properties":{
             "time":"keyword",        <---- here

UPDATE Here is the correct mapping you're looking for:

{
  "settings": {
    "number_of_shards": "1",
    "number_of_replicas": "1"
  },
  "mappings": {
    "properties": {
      "data": {
        "type": "nested",
        "properties": {
          "title": {
            "type": "text"
          },
          "sources": {
            "type": "keyword"
          },
          "flags": {
            "type": "keyword",
            "null_value": "NULL"
          }
        }
      },
      "steps": {
        "type": "nested",
        "properties": {
          "time": {
            "type": "keyword"
          },
          "products": {
            "type": "nested",
            "properties": {
              "name": {
                "type": "text"
              },
              "link": {
                "type": "keyword",
                "null_value": "NULL"
              },
              "type": {
                "type": "keyword",
                "null_value": "NULL"
              },
              "ingredients": {
                "type": "keyword",
                "null_value": "NULL"
              },
              "flags": {
                "type": "keyword",
                "null_value": "NULL"
              }
            }
          }
        }
      }
    }
  }
}

Upvotes: 1

Related Questions