Skip to content

Remove obsolete _type field references#1028

Merged
AlfonsoUceda merged 1 commit into
toptal:masterfrom
mattmenefee:remove-type-field
Jun 2, 2026
Merged

Remove obsolete _type field references#1028
AlfonsoUceda merged 1 commit into
toptal:masterfrom
mattmenefee:remove-type-field

Conversation

@mattmenefee

@mattmenefee mattmenefee commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Removes the obsolete _type field from Chewy. Elasticsearch removed _type from search responses in 8.0 (ES 7 already returned only the placeholder _doc), so these references no longer matched real ES responses.
  • _type was still present in mock response helpers (Chewy::Minitest::Helpers, Chewy::Rspec::Helpers), so the fixtures they produced were misleading for anyone writing assertions against them.
  • Also removed from Chewy::Search::Request::EVERFIELDS (along with the long-obsolete _parent entry), the pluck documentation, Chewy::Index::Wrapper generated accessors, and the README response example.
  • Documents the mock-helper assertion change in the Chewy 7 / ES 7 → Chewy 8 / ES 8 migration guide section (the upgrade where _type actually disappeared from responses).
  • Behavioral no-op against ES 8+/9 clusters (none return _type); this only aligns the code and test fixtures with what Elasticsearch actually returns.

Test plan

  • bundle exec rspec spec/chewy/rspec/helpers_spec.rb spec/chewy/minitest/helpers_spec.rb spec/chewy/search/response_spec.rb spec/chewy/index/wrapper_spec.rb (69 examples, 0 failures)
  • bundle exec rspec spec/chewy/search/request_spec.rb -e pluck (5 examples, 0 failures — exercises the EVERFIELDS path)
  • CI green across the supported ES matrix

@mattmenefee
mattmenefee requested a review from a team as a code owner June 1, 2026 22:45
Elasticsearch removed the `_type` field from search responses in 8.0
(ES 7 already returned only the placeholder `_doc`), so Chewy's lingering
`_type` references no longer matched real responses. The mock response
helpers in particular produced fixtures that did not reflect what ES
actually returns, which could mislead users writing assertions against
them.

This removes `_type` from:

- `Chewy::Minitest::Helpers` and `Chewy::Rspec::Helpers` mock responses
- `Chewy::Search::Request::EVERFIELDS` (also drops the long-obsolete
  `_parent` entry) and the `pluck` documentation
- `Chewy::Index::Wrapper` generated accessors
- the README response example and associated specs

It also documents the mock-helper assertion change in the Chewy 7 / ES 7
to Chewy 8 / ES 8 migration guide section.

This is a behavioral no-op against ES 8+/9 clusters (none return
`_type`); it simply aligns the code and test fixtures with actual
Elasticsearch responses.
@AlfonsoUceda

Copy link
Copy Markdown
Contributor

Thanks @mattmenefee

@AlfonsoUceda
AlfonsoUceda merged commit ca71816 into toptal:master Jun 2, 2026
13 checks passed
@mattmenefee
mattmenefee deleted the remove-type-field branch June 3, 2026 18:37
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

Successfully merging this pull request may close these issues.

2 participants