2

How the following settings can be add to python elastic search module. Please provide a example. I have created indexes and mappings. But I am stuck with settings.

curl -XPUT "http://localhost:9200/blurays " -d'
{
   "settings": {
     "analysis": {
     "filter": {
        "nGram_filter": {
           "type": "nGram",
           "min_gram": 2,
           "max_gram": 20,
           "token_chars": [
              "letter",
              "digit",
              "punctuation",
              "symbol"
           ]
        }
     },
     "analyzer": {
        "nGram_analyzer": {
           "type": "custom",
           "tokenizer": "whitespace",
           "filter": [
              "lowercase",
              "asciifolding",
              "nGram_filter"
           ]
        },
        "whitespace_analyzer": {
           "type": "custom",
           "tokenizer": "whitespace",
           "filter": [
              "lowercase",
              "asciifolding"
           ]
        }
     }
  }
 },
4
  • What you want to do with this settings? You want to push this settings to index ? Commented Dec 2, 2014 at 5:59
  • @Lafada Yes man. I want these settings to be used at my index. I have to upload some documents with these settings and at the end I want to implement a auto complete suggester. Commented Dec 2, 2014 at 6:02
  • You want to do this using py-elasticsearch module ? Commented Dec 2, 2014 at 6:12
  • @Lafada - Exactly. using the py-elasticsearch module. Pls help. Commented Dec 2, 2014 at 6:15

2 Answers 2

6

If your index already exists, you can update its settings with elasticsearch.indices.put_settings.

Sign up to request clarification or add additional context in comments.

Comments

2

You can use elasticsearch.indices.create and pass the settings as body.

Docs says:

create(*args, **kwargs)

Create an index in Elasticsearch. http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html

Parameters:

  • index – The name of the index
  • body – The configuration for the index (settings and mappings)
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout

So you can pass body with settings argument.

Comments

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.