4

I am trying to create a ES index with custom mapping with elasticsearch python to increase the size of text in each document:

mapping = {"mapping":{
           "properties":{
             "Apple":{"type":"text","ignore_above":1000},
             "Mango":{"type":"text","ignore_above":1000}
           }
          }}

Creation:

from elasticsearch import Elasticsearch
es1 = Elasticsearch([{"host":"localhost","port":9200}])
es1.indices.create(index="hello",body=mapping)

Error:

RequestError: RequestError(400, 'mapper_parsing_exception', 'Mapping definition for [Apple] has unsupported parameters: [ignore_above : 10000]') 

But I checked the elasticsearch website on how to increase the text length limit and ignore_above was the option given there. https://www.elastic.co/guide/en/elasticsearch/reference/current/ignore-above.html

Any suggestions on how to rectify this will be great.

1 Answer 1

1

The ignore_above setting is only for keyword types not text, so just change your mapping to this and it will work:

mapping = {"mapping":{
       "properties":{
         "Apple":{"type":"text"},
         "Mango":{"type":"text"}
       }
      }}

If you absolutely need to be able to specify ignore_above then you need to change the type to keyword, like this:

mapping = {"mapping":{
       "properties":{
         "Apple":{"type":"keyword","ignore_above":1000},
         "Mango":{"type":"keyword","ignore_above":1000}
       }
      }}
Sign up to request clarification or add additional context in comments.

1 Comment

But I need to change the ignore_above to 1000 since I am trying to load a pandas DF which has string values greater than 256, the default length.

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.