diff --git a/lib/chewy/minitest/helpers.rb b/lib/chewy/minitest/helpers.rb index 26ff95e3f..e9fbd1362 100644 --- a/lib/chewy/minitest/helpers.rb +++ b/lib/chewy/minitest/helpers.rb @@ -97,7 +97,7 @@ def mock_elasticsearch_response_sources(index, hits, &block) { '_index' => index.index_name, '_type' => '_doc', - '_id' => (i + 1).to_s, + '_id' => hit[:id] || (i + 1).to_s, '_score' => 3.14, '_source' => hit }