harsh patel
harsh patel

Reputation: 67

What is the field "your_type" in Elasticsearch PUT request?

I am trying to resolve this error:

Fielddata is disabled on text fields by default. Set fielddata=true on

and saw one post which suggested me to do this; but I didn't get what is your_type endpoint in the given snippet:

PUT your_index/_mapping/your_type

Upvotes: 0

Views: 133

Answers (1)

rabbitbr
rabbitbr

Reputation: 3261

I don't know what version of ElasticSearch you have but as of 7.x the mapping type has been removed.

In your case it could run like this (version > 7.x)

PUT my-index-000001/_mapping
{
  "properties": {
     "name-field": {
       "type": "text",
       "fielddata": true
     }
  }
}

A little about the mapping type:

Since the first release of Elasticsearch, each document has been stored in a single index and assigned a single mapping type. A mapping type was used to represent the type of document or entity being indexed, for instance a twitter index might have a user type and a tweet type.

Each mapping type could have its own fields, so the user type might have a full_name field, a user_name field, and an email field, while the tweet type could have a content field, a tweeted_at field and, like the user type, a user_name field.

More information here: https://www.elastic.co/guide/en/elasticsearch/reference/6.5/removal-of-types.html#_why_are_mapping_types_being_removed

Upvotes: 1

Related Questions