Search code examples
elasticsearchsearchkick

Rails, searchkick (Elasticsearch 2.3) completion suggester error


I'm using a legacy ES 2.3 and searchkick 2.5 versions in an app.

A custom mapping is defined in a model.

mappings: {
  my_model: {
    properties: { 
      ...
      suggestion: { type: "completion", analyzer: "ru_RU", search_analyzer: "ru_RU" }
    }
  }
}

def search_data
  {
    ...
    suggestion: suggestions
  }
end

# a custom method on the model to fill suggestions
def suggestions
 ['some', 'suggestions'] # an array 
end

When I'm trying to reindex the model I get Mixing up field types: class org.elasticsearch.index.mapper.core.StringFieldMapper$StringFieldType != class org.elasticsearch.index.mapper.core.CompletionFieldMapper$CompletionFieldType on field suggestion error.

What am I doing wrong? Would really appreciate any help with solving this issue.


Solution

  • solved by upgrading ES version to 2.4