0

I put the mapping for a field question_title, with following:

PUT mac/_settings
{
  "mappings": {
    "ask_expert_published_prod": {
      "properties": {
        "question_title": {
          "type": "string",
          "analyzer": "english"
        }
      }
    }
  }
}

But, when i see the mapping for the type through:

GET myindex/mytype/_mapping

it still shows only type='string' for the field, as following:

"question_title": {
                  "type": "string"
               },

Was the mapping properly updated on the field. If not, how can I do it.

1 Answer 1

1

In your initial command, remove _settings from the path, since it is only for updating the index settings not mappings.

Simply run this:

PUT mac
{
  "mappings": {
    "ask_expert_published_prod": {
      "properties": {
        "question_title": {
          "type": "string",
          "analyzer": "english"
        }
      }
    }
  }
}
Sign up to request clarification or add additional context in comments.

6 Comments

when i execute the above, it gives error "index already exists".. How do we resolve that? When I give with _settings, it at least goes through and says "acknowledged" : true.
Simply delete the index first with DELETE mac
No, i dont want to delete the index, as i have lot of data in it. Can't i update it.
Your indexed data is worthless anyway, since you want to change the mapping you'll have to re-index it all anyway.
so, @val, i will tell u the exact thing. See i created the index first, then inserted data in one of the types and then i added the analyzer, so want to know if the analyzer will be applied to all the fields of the type by default. If no, how to make sure the newly added analyzer works for appropriate fields.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.