Skip to content

Commit

Permalink
Make SearchTemplateRequest implement IndicesRequest.Replaceable (#9122)
Browse files Browse the repository at this point in the history
* Make SearchTemplateRequest implement IndicesRequest.Replaceable

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Add to CHANGELOG

Signed-off-by: Craig Perkins <cwperx@amazon.com>

---------

Signed-off-by: Craig Perkins <cwperx@amazon.com>
(cherry picked from commit c73f727)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Aug 11, 2023
1 parent bc69838 commit b4e424c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- [distribution/archives] [Linux] [x64] Provide the variant of the distributions bundled with JRE ([#8195]()https://github.com/opensearch-project/OpenSearch/pull/8195)
- Prioritize replica shard movement during shard relocation ([#8875](https://github.com/opensearch-project/OpenSearch/pull/8875))
- Introducing Default and Best Compression codecs as their algorithm name ([#9123]()https://github.com/opensearch-project/OpenSearch/pull/9123)
- Make SearchTemplateRequest implement IndicesRequest.Replaceable ([#9122]()https://github.com/opensearch-project/OpenSearch/pull/9122)

### Dependencies
- Bump `org.apache.logging.log4j:log4j-core` from 2.17.1 to 2.20.0 ([#8307](https://github.com/opensearch-project/OpenSearch/pull/8307))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
import org.opensearch.action.ActionRequest;
import org.opensearch.action.ActionRequestValidationException;
import org.opensearch.action.CompositeIndicesRequest;
import org.opensearch.action.IndicesRequest;
import org.opensearch.action.search.SearchRequest;
import org.opensearch.action.support.IndicesOptions;
import org.opensearch.core.ParseField;
import org.opensearch.core.common.ParsingException;
import org.opensearch.core.common.io.stream.StreamInput;
Expand All @@ -56,7 +58,7 @@
/**
* A request to execute a search based on a search template.
*/
public class SearchTemplateRequest extends ActionRequest implements CompositeIndicesRequest, ToXContentObject {
public class SearchTemplateRequest extends ActionRequest implements IndicesRequest.Replaceable, CompositeIndicesRequest, ToXContentObject {

private SearchRequest request;
private boolean simulate = false;
Expand Down Expand Up @@ -254,4 +256,19 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeMap(scriptParams);
}
}

@Override
public String[] indices() {
return request.indices();

Check warning on line 262 in modules/lang-mustache/src/main/java/org/opensearch/script/mustache/SearchTemplateRequest.java

View check run for this annotation

Codecov / codecov/patch

modules/lang-mustache/src/main/java/org/opensearch/script/mustache/SearchTemplateRequest.java#L262

Added line #L262 was not covered by tests
}

@Override
public IndicesOptions indicesOptions() {
return request.indicesOptions();

Check warning on line 267 in modules/lang-mustache/src/main/java/org/opensearch/script/mustache/SearchTemplateRequest.java

View check run for this annotation

Codecov / codecov/patch

modules/lang-mustache/src/main/java/org/opensearch/script/mustache/SearchTemplateRequest.java#L267

Added line #L267 was not covered by tests
}

@Override
public IndicesRequest indices(String... indices) {
return request.indices(indices);

Check warning on line 272 in modules/lang-mustache/src/main/java/org/opensearch/script/mustache/SearchTemplateRequest.java

View check run for this annotation

Codecov / codecov/patch

modules/lang-mustache/src/main/java/org/opensearch/script/mustache/SearchTemplateRequest.java#L272

Added line #L272 was not covered by tests
}
}

0 comments on commit b4e424c

Please sign in to comment.