Skip to content

Breaking change at 7.2.4 #891

@jiajiawang

Description

@jiajiawang

We found a breaking change when upgrade from 7.2.3 to 7.2.4.
It's coming from this particular change v7.2.3...v7.2.4#diff-1eea599674257ec549622b98226f87c29e1467eddf042b787451b575f0432807R31

Basically we have an index serves as a logging system. The logging record doesn't have uniq attribute like an id. So different logging records can be exactly same. But they are NOT technically duplicate records.
With that uniq change, chewy import would remove docs that have exact same body silently.


Expected behavior

Records with same body shouldn't be removed when bulk import.

Actual behavior

Records with same body are removed when bulk import.

Steps to reproduce the problem

Assume we have

class Log
  include ActiveModel::Model
  include ActiveModel::Serialization

  attr_accessor :user_id, :product_id, :action_type
end

class LogIndex < Chewy::Index
  index_scope Log

  field :user_id, type: "long"
  field :product_id, type: "long"
  field :action_type, type: "keyword"
end

Then in rails console

pry(main)> LogIndex.import([Log.new(user_id: 1, product_id: 1, action_type: "view"), Log.new(user_id: 1, product_id: 1, action_type: "view")])
ETHON: performed EASY effective_url=http://localhost:9200/log response_code=200 return_code=ok total_time=0.003941
ETHON: performed EASY effective_url=http://localhost:9200/log/_bulk?refresh=true response_code=200 return_code=ok total_time=0.138049
  LogIndex Import (144.4ms) {:index=>2}
=> true
pry(main)> LogIndex.total
ETHON: performed EASY effective_url=http://localhost:9200/log/_search?track_total_hits=true response_code=200 return_code=ok total_time=0.009112
  LogIndex Search (12.2ms) {:index=>["log"], :body=>{}, :track_total_hits=>true}
=> 1

It says 2 docs were indexed. But in actual, only 1 doc was successfully indexed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions