Skip to content

Commit

Permalink
Add changelog and REST test
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Froh <[email protected]>
  • Loading branch information
msfroh committed Dec 10, 2024
1 parent b4aaa2f commit 1680b9b
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Changed
- Indexed IP field supports `terms_query` with more than 1025 IP masks [#16391](https://github.com/opensearch-project/OpenSearch/pull/16391)
- Make entries for dependencies from server/build.gradle to gradle version catalog ([#16707](https://github.com/opensearch-project/OpenSearch/pull/16707))
- Sliced search only fans out to shards matched by the selected slice, reducing open search contexts ([#16771](https://github.com/opensearch-project/OpenSearch/pull/16771))

### Deprecated
- Performing update operation with default pipeline or final pipeline is deprecated ([#16712](https://github.com/opensearch-project/OpenSearch/pull/16712))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
"default":"open",
"description":"Whether to expand wildcard expression to concrete indices that are open, closed or both."
}
},
"body":{
"description":"The search source (in order to specify slice parameters)"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
"Search shards with slice specified in body":
- do:
indices.create:
index: test_index
body:
settings:
index:
number_of_shards: 7
number_of_replicas: 0

- do:
search_shards:
index: test_index
body:
slice:
id: 0
max: 3
- length: { shards: 3 }
- match: { shards.0.0.index: "test_index" }
- match: { shards.0.0.shard: 0 }
- match: { shards.1.0.shard: 3 }
- match: { shards.2.0.shard: 6 }

- do:
search_shards:
index: test_index
body:
slice:
id: 1
max: 3
- length: { shards: 2 }
- match: { shards.0.0.index: "test_index" }
- match: { shards.0.0.shard: 1 }
- match: { shards.1.0.shard: 4 }

- do:
search_shards:
index: test_index
body:
slice:
id: 2
max: 3
- length: { shards: 2 }
- match: { shards.0.0.index: "test_index" }
- match: { shards.0.0.shard: 2 }
- match: { shards.1.0.shard: 5 }


- do:
search_shards:
index: test_index
preference: "_shards:0,2,4,6"
body:
slice:
id: 0
max: 3
- length: { shards: 2 }
- match: { shards.0.0.index: "test_index" }
- match: { shards.0.0.shard: 0 }
- match: { shards.1.0.shard: 6 }

- do:
search_shards:
index: test_index
preference: "_shards:0,2,4,6"
body:
slice:
id: 1
max: 3
- length: { shards: 1 }
- match: { shards.0.0.index: "test_index" }
- match: { shards.0.0.shard: 2 }

- do:
search_shards:
index: test_index
preference: "_shards:0,2,4,6"
body:
slice:
id: 2
max: 3
- length: { shards: 1 }
- match: { shards.0.0.index: "test_index" }
- match: { shards.0.0.shard: 4 }
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
clusterSearchShardsRequest.routing(request.param("routing"));
clusterSearchShardsRequest.preference(request.param("preference"));
clusterSearchShardsRequest.indicesOptions(IndicesOptions.fromRequest(request, clusterSearchShardsRequest.indicesOptions()));
if (request.hasContent()) {
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
request.withContentOrSourceParamParserOrNull(sourceBuilder::parseXContent);
if (request.hasContentOrSourceParam()) {
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.parseXContent(request.contentOrSourceParamParser());
if (sourceBuilder.slice() != null) {
clusterSearchShardsRequest.slice(sourceBuilder.slice());
}
Expand Down

0 comments on commit 1680b9b

Please sign in to comment.