mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-25 17:38:44 +00:00
Reindex: fix reindex-from-remote from <2.0 (#22931)
In 5.2 we stopped sending the source parameter if the user didn't specify it. This was a mistake as versions before 2.0 look like they don't always include the `_source`. This is because reindex requests some metadata fields. Anyway, now we say `"_source": true` if there isn't a `_source` configured in the reindex request. Closes #22893
This commit is contained in:
parent
f86fd62821
commit
ce8e042b66
@ -124,6 +124,8 @@ final class RemoteRequestBuilders {
|
||||
|
||||
if (searchRequest.source().fetchSource() != null) {
|
||||
entity.field("_source", searchRequest.source().fetchSource());
|
||||
} else {
|
||||
entity.field("_source", true);
|
||||
}
|
||||
|
||||
entity.endObject();
|
||||
|
@ -160,7 +160,7 @@ public class RemoteRequestBuildersTests extends ESTestCase {
|
||||
String query = "{\"match_all\":{}}";
|
||||
HttpEntity entity = initialSearchEntity(searchRequest, new BytesArray(query));
|
||||
assertEquals(ContentType.APPLICATION_JSON.toString(), entity.getContentType().getValue());
|
||||
assertEquals("{\"query\":" + query + "}",
|
||||
assertEquals("{\"query\":" + query + ",\"_source\":true}",
|
||||
Streams.copyToString(new InputStreamReader(entity.getContent(), StandardCharsets.UTF_8)));
|
||||
|
||||
// Source filtering is included if set up
|
||||
|
Loading…
x
Reference in New Issue
Block a user