Alex Nikitin
Alex Nikitin

Reputation: 931

ElasticSearch Failed to parse mapping

I am trying to create new index with put request http://localhost:9200/songs with following mapping

{
"mappings": {
    "songs": {
        "properties": {
            "artist_name": {
                "type": "text"
            },
            "songs": {
                "type": "nested",
                "properties": {
                    "name": {
                        "type": "keyword"
                    },
                    "lyric": {
                        "type": "keyword"
                    }
                }
            }
        }
    }
}

}

Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters:  [songs : {properties={artist_name={type=text}, songs={type=nested, properties={lyric={type=keyword}, name={type=keyword}}}}}]"

The json structure is valid. Where am I wrong?

Upvotes: 1

Views: 2225

Answers (1)

Kamal Kunjapur
Kamal Kunjapur

Reputation: 8840

You seem to be using ES version 7 where the type has been deprecated as mentioned here:

Change your mapping to the below and it should work.

PUT <your_index_name>
{
  "mappings": {
    "properties": {
      "artist_name": {
        "type": "text"
      },
      "songs": {
        "type": "nested",
        "properties": {
          "name": {
            "type": "keyword"
          },
          "lyric": {
            "type": "keyword"
          }
        }
      }
    }
  }
}

Hope this helps!

Upvotes: 1

Related Questions