Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking change at 7.2.4 #891

Open
jiajiawang opened this issue Aug 16, 2023 · 0 comments
Open

Breaking change at 7.2.4 #891

jiajiawang opened this issue Aug 16, 2023 · 0 comments

Comments

@jiajiawang
Copy link
Contributor

jiajiawang commented Aug 16, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant