1

I'm trying to get this code to work but I'm getting the below error: Reference : https://www.youtube.com/watch?v=PQGlhbf7o7c

Please let me know how this can be fixed. Thank You.

Code:

PUT test
{
  "settings": {
    "index": {
      "analysis": {
        "filter": {},
        "analyzer": {
          "keyword_analyzer": {
            "filter": [
              "lowercase",
              "asciifolding",
              "trim"
            ],
            "char_filter": [],
            "type": "custom",
            "tokenizer": "keywords"
          },
          "edge_ngram_analyzer": {
            "filter": [
              "lowercase"
            ],
            "tokenizer": "edge_ngram_tokenizer"
          },
          "edge_ngram_search_analyzer": {
            "tokenizer": "lowercase"
          },
          "tokenizer": {
            "edge_ngram_tokenizer": {
              "type": "edge_ngram",
              "min_gram": 2,
              "max_gram": 5,
              "token_chars": [
                "letter"
              ]
            }
          }
        }
      }
    },
    "mappings": {
      "properties": {
        "name": {
          "type": "text",
          "fields": {
            "keywordstring": {
              "type": "text",
              "analyzer": "keyword_analyzer"
            },
            "edgengram": {
              "type": "text",
              "analyzer": "edge_ngram_analyzer",
              "search_analyzer": "edge_ngram_search_analyzer"
            },
            "completion": {
              "type": "completion"
            }
          },
          "analyzer": "standard"
        }
      }
    }
  }
}

Error

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "unknown setting [index.mappings.properties.name.analyzer] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "unknown setting [index.mappings.properties.name.analyzer] please check that any required plugins are installed, or check the breaking changes documentation for removed settings",
    "suppressed" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "unknown setting [index.mappings.properties.name.fields.completion.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      },
      {
        "type" : "illegal_argument_exception",
        "reason" : "unknown setting [index.mappings.properties.name.fields.edgengram.analyzer] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      },
      {
        "type" : "illegal_argument_exception",
        "reason" : "unknown setting [index.mappings.properties.name.fields.edgengram.search_analyzer] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      },
      {
        "type" : "illegal_argument_exception",
        "reason" : "unknown setting [index.mappings.properties.name.fields.edgengram.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      },
      {
        "type" : "illegal_argument_exception",
        "reason" : "unknown setting [index.mappings.properties.name.fields.keywordstring.analyzer] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      },
      {
        "type" : "illegal_argument_exception",
        "reason" : "unknown setting [index.mappings.properties.name.fields.keywordstring.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      },
      {
        "type" : "illegal_argument_exception",
        "reason" : "unknown setting [index.mappings.properties.name.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      }
    ]
  },
  "status" : 400
}
jason
  • 3,932
  • 11
  • 52
  • 123

1 Answers1

1

You were almost there but the payload structure when creating an index should like this:

PUT test
{
  "settings": {
    "analysis": {
       ...
    }
  },
  "mappings": {
    "properties": {
       ...
    }
  }
}

In your case this would mean:

PUT test
{
  "settings": {
    "analysis": {
      "filter": {},
      "analyzer": {
        "keyword_analyzer": {
          "filter": [
            "lowercase",
            "asciifolding",
            "trim"
          ],
          "char_filter": [],
          "type": "custom",
          "tokenizer": "keywords"
        },
        "edge_ngram_analyzer": {
          "filter": [
            "lowercase"
          ],
          "tokenizer": "edge_ngram_tokenizer"
        },
        "edge_ngram_search_analyzer": {
          "tokenizer": "lowercase"
        },
        "tokenizer": {
          "edge_ngram_tokenizer": {
            "type": "edge_ngram",
            "min_gram": 2,
            "max_gram": 5,
            "token_chars": [
              "letter"
            ]
          }
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "name": {
        "type": "text",
        "fields": {
          "keywordstring": {
            "type": "text",
            "analyzer": "keyword_analyzer"
          },
          "edgengram": {
            "type": "text",
            "analyzer": "edge_ngram_analyzer",
            "search_analyzer": "edge_ngram_search_analyzer"
          },
          "completion": {
            "type": "completion"
          }
        },
        "analyzer": "standard"
      }
    }
  }
}
Joe - GMapsBook.com
  • 15,787
  • 4
  • 23
  • 68