searchkick reindex无法在staging环境

时间:2018-02-23 13:21:18

标签: searchkick

在开发环境中,Moment.reindex和搜索没问题,但在staging env中是错误的:

2.3.1 :002 > Moment.reindex
Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":{"root_cause":[{"type":"parse_exception","reason":"Failed to parse content to map"}],"type":"parse_exception","reason":"Failed to parse content to map","caused_by":{"type":"json_parse_exception","reason":"Duplicate field 'moment'\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@1e0d7046; line: 1, column: 2720]"}},"status":400}

使用相同的ES加入环境。

我的时刻课程:

class Moment
  include Mongoid::Document
  searchkick inheritance: true, callbacks: :async, merge_mappings: true, mappings: {
moment: {
  properties: {
    text: {
      type: "text",
      # analyzer: "ik_max_word",
      fields: {
        analyzed: {
          type: "text",
          analyzer: "ik_max_word"
        }
      }
    }
  }
}

}}

GET /_cat/indices?v
health status index                                 
yellow open   moments_development_20180223203756302        
yellow open   moments_staging      

1 个答案:

答案 0 :(得分:0)

这是how mappings were merged的问题。最新版本的Searchkick已修复。