Rails,searchkick(Elasticsearch 2.3)完成建议程序错误

时间:2019-06-07 10:01:31

标签: elasticsearch searchkick

我在应用中使用的是旧版ES 2.3和searchkick 2.5版本。

在模型中定义了自定义映射。

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

当我尝试为模型重新编制索引时,出现Mixing up field types: class org.elasticsearch.index.mapper.core.StringFieldMapper$StringFieldType != class org.elasticsearch.index.mapper.core.CompletionFieldMapper$CompletionFieldType on field suggestion错误。

我在做什么错? 非常感谢您为解决此问题提供的帮助。

1 个答案:

答案 0 :(得分:2)

通过将ES版本升级到2.4解决

相关问题