Merge pull request #14030 from jaymode/render_search_client
move render search template methods to cluster admin client
This commit is contained in:
commit
af068fcd14
|
@ -77,6 +77,9 @@ import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse;
|
|||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
|
||||
import org.elasticsearch.action.admin.cluster.validate.template.RenderSearchTemplateRequest;
|
||||
import org.elasticsearch.action.admin.cluster.validate.template.RenderSearchTemplateRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.validate.template.RenderSearchTemplateResponse;
|
||||
|
||||
/**
|
||||
* Administrative actions/operations against indices.
|
||||
|
@ -423,4 +426,25 @@ public interface ClusterAdminClient extends ElasticsearchClient {
|
|||
*/
|
||||
SnapshotsStatusRequestBuilder prepareSnapshotStatus();
|
||||
|
||||
|
||||
/**
|
||||
* Return the rendered search request for a given search template.
|
||||
*
|
||||
* @param request The request
|
||||
* @return The result future
|
||||
*/
|
||||
ActionFuture<RenderSearchTemplateResponse> renderSearchTemplate(RenderSearchTemplateRequest request);
|
||||
|
||||
/**
|
||||
* Return the rendered search request for a given search template.
|
||||
*
|
||||
* @param request The request
|
||||
* @param listener A listener to be notified of the result
|
||||
*/
|
||||
void renderSearchTemplate(RenderSearchTemplateRequest request, ActionListener<RenderSearchTemplateResponse> listener);
|
||||
|
||||
/**
|
||||
* Return the rendered search request for a given search template.
|
||||
*/
|
||||
RenderSearchTemplateRequestBuilder prepareRenderSearchTemplate();
|
||||
}
|
||||
|
|
|
@ -105,9 +105,6 @@ import org.elasticsearch.action.admin.indices.upgrade.post.UpgradeResponse;
|
|||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.validate.template.RenderSearchTemplateRequest;
|
||||
import org.elasticsearch.action.admin.cluster.validate.template.RenderSearchTemplateRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.validate.template.RenderSearchTemplateResponse;
|
||||
import org.elasticsearch.action.admin.indices.warmer.delete.DeleteWarmerRequest;
|
||||
import org.elasticsearch.action.admin.indices.warmer.delete.DeleteWarmerRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.warmer.delete.DeleteWarmerResponse;
|
||||
|
@ -746,27 +743,6 @@ public interface IndicesAdminClient extends ElasticsearchClient {
|
|||
*/
|
||||
ValidateQueryRequestBuilder prepareValidateQuery(String... indices);
|
||||
|
||||
/**
|
||||
* Return the rendered search request for a given search template.
|
||||
*
|
||||
* @param request The request
|
||||
* @return The result future
|
||||
*/
|
||||
ActionFuture<RenderSearchTemplateResponse> renderSearchTemplate(RenderSearchTemplateRequest request);
|
||||
|
||||
/**
|
||||
* Return the rendered search request for a given search template.
|
||||
*
|
||||
* @param request The request
|
||||
* @param listener A listener to be notified of the result
|
||||
*/
|
||||
void renderSearchTemplate(RenderSearchTemplateRequest request, ActionListener<RenderSearchTemplateResponse> listener);
|
||||
|
||||
/**
|
||||
* Return the rendered search request for a given search template.
|
||||
*/
|
||||
RenderSearchTemplateRequestBuilder prepareRenderSearchTemplate();
|
||||
|
||||
/**
|
||||
* Puts an index search warmer to be applies when applicable.
|
||||
*/
|
||||
|
|
|
@ -1142,6 +1142,21 @@ public abstract class AbstractClient extends AbstractComponent implements Client
|
|||
public SnapshotsStatusRequestBuilder prepareSnapshotStatus() {
|
||||
return new SnapshotsStatusRequestBuilder(this, SnapshotsStatusAction.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<RenderSearchTemplateResponse> renderSearchTemplate(final RenderSearchTemplateRequest request) {
|
||||
return execute(RenderSearchTemplateAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSearchTemplate(final RenderSearchTemplateRequest request, final ActionListener<RenderSearchTemplateResponse> listener) {
|
||||
execute(RenderSearchTemplateAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderSearchTemplateRequestBuilder prepareRenderSearchTemplate() {
|
||||
return new RenderSearchTemplateRequestBuilder(this, RenderSearchTemplateAction.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
static class IndicesAdmin implements IndicesAdminClient {
|
||||
|
@ -1617,21 +1632,6 @@ public abstract class AbstractClient extends AbstractComponent implements Client
|
|||
return new ValidateQueryRequestBuilder(this, ValidateQueryAction.INSTANCE).setIndices(indices);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<RenderSearchTemplateResponse> renderSearchTemplate(final RenderSearchTemplateRequest request) {
|
||||
return execute(RenderSearchTemplateAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSearchTemplate(final RenderSearchTemplateRequest request, final ActionListener<RenderSearchTemplateResponse> listener) {
|
||||
execute(RenderSearchTemplateAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderSearchTemplateRequestBuilder prepareRenderSearchTemplate() {
|
||||
return new RenderSearchTemplateRequestBuilder(this, RenderSearchTemplateAction.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<PutWarmerResponse> putWarmer(PutWarmerRequest request) {
|
||||
return execute(PutWarmerAction.INSTANCE, request);
|
||||
|
|
|
@ -93,7 +93,7 @@ public class RestRenderSearchTemplateAction extends BaseRestHandler {
|
|||
}
|
||||
renderSearchTemplateRequest = new RenderSearchTemplateRequest();
|
||||
renderSearchTemplateRequest.template(template);
|
||||
client.admin().indices().renderSearchTemplate(renderSearchTemplateRequest, new RestBuilderListener<RenderSearchTemplateResponse>(channel) {
|
||||
client.admin().cluster().renderSearchTemplate(renderSearchTemplateRequest, new RestBuilderListener<RenderSearchTemplateResponse>(channel) {
|
||||
|
||||
@Override
|
||||
public RestResponse buildResponse(RenderSearchTemplateResponse response, XContentBuilder builder) throws Exception {
|
||||
|
|
|
@ -61,7 +61,7 @@ public class RenderSearchTemplateIT extends ESIntegTestCase {
|
|||
params.put("value", "bar");
|
||||
params.put("size", 20);
|
||||
Template template = new Template(TEMPLATE_CONTENTS, ScriptType.INLINE, MustacheScriptEngineService.NAME, XContentType.JSON, params);
|
||||
RenderSearchTemplateResponse response = client().admin().indices().prepareRenderSearchTemplate().template(template).get();
|
||||
RenderSearchTemplateResponse response = client().admin().cluster().prepareRenderSearchTemplate().template(template).get();
|
||||
assertThat(response, notNullValue());
|
||||
BytesReference source = response.source();
|
||||
assertThat(source, notNullValue());
|
||||
|
@ -75,7 +75,7 @@ public class RenderSearchTemplateIT extends ESIntegTestCase {
|
|||
params.put("value", "baz");
|
||||
params.put("size", 100);
|
||||
template = new Template(TEMPLATE_CONTENTS, ScriptType.INLINE, MustacheScriptEngineService.NAME, XContentType.JSON, params);
|
||||
response = client().admin().indices().prepareRenderSearchTemplate().template(template).get();
|
||||
response = client().admin().cluster().prepareRenderSearchTemplate().template(template).get();
|
||||
assertThat(response, notNullValue());
|
||||
source = response.source();
|
||||
assertThat(source, notNullValue());
|
||||
|
@ -91,7 +91,7 @@ public class RenderSearchTemplateIT extends ESIntegTestCase {
|
|||
params.put("value", "bar");
|
||||
params.put("size", 20);
|
||||
Template template = new Template("index_template_1", ScriptType.INDEXED, MustacheScriptEngineService.NAME, XContentType.JSON, params);
|
||||
RenderSearchTemplateResponse response = client().admin().indices().prepareRenderSearchTemplate().template(template).get();
|
||||
RenderSearchTemplateResponse response = client().admin().cluster().prepareRenderSearchTemplate().template(template).get();
|
||||
assertThat(response, notNullValue());
|
||||
BytesReference source = response.source();
|
||||
assertThat(source, notNullValue());
|
||||
|
@ -105,7 +105,7 @@ public class RenderSearchTemplateIT extends ESIntegTestCase {
|
|||
params.put("value", "baz");
|
||||
params.put("size", 100);
|
||||
template = new Template("index_template_1", ScriptType.INDEXED, MustacheScriptEngineService.NAME, XContentType.JSON, params);
|
||||
response = client().admin().indices().prepareRenderSearchTemplate().template(template).get();
|
||||
response = client().admin().cluster().prepareRenderSearchTemplate().template(template).get();
|
||||
assertThat(response, notNullValue());
|
||||
source = response.source();
|
||||
assertThat(source, notNullValue());
|
||||
|
@ -121,7 +121,7 @@ public class RenderSearchTemplateIT extends ESIntegTestCase {
|
|||
params.put("value", "bar");
|
||||
params.put("size", 20);
|
||||
Template template = new Template("file_template_1", ScriptType.FILE, MustacheScriptEngineService.NAME, XContentType.JSON, params);
|
||||
RenderSearchTemplateResponse response = client().admin().indices().prepareRenderSearchTemplate().template(template).get();
|
||||
RenderSearchTemplateResponse response = client().admin().cluster().prepareRenderSearchTemplate().template(template).get();
|
||||
assertThat(response, notNullValue());
|
||||
BytesReference source = response.source();
|
||||
assertThat(source, notNullValue());
|
||||
|
@ -135,7 +135,7 @@ public class RenderSearchTemplateIT extends ESIntegTestCase {
|
|||
params.put("value", "baz");
|
||||
params.put("size", 100);
|
||||
template = new Template("file_template_1", ScriptType.FILE, MustacheScriptEngineService.NAME, XContentType.JSON, params);
|
||||
response = client().admin().indices().prepareRenderSearchTemplate().template(template).get();
|
||||
response = client().admin().cluster().prepareRenderSearchTemplate().template(template).get();
|
||||
assertThat(response, notNullValue());
|
||||
source = response.source();
|
||||
assertThat(source, notNullValue());
|
||||
|
|
Loading…
Reference in New Issue