parent
3f344d3154
commit
2fdf79d8d4
|
@ -309,4 +309,9 @@ transportClient.addTransportAddress(
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
|
||||||
Also the helper methods in `QueryBuilders` class that create a `TemplateQueryBuilder` instance have been removed,
|
Also the helper methods in `QueryBuilders` class that create a `TemplateQueryBuilder` instance have been removed,
|
||||||
instead the constructors on `TemplateQueryBuilder` should be used.
|
instead the constructors on `TemplateQueryBuilder` should be used.
|
||||||
|
|
||||||
|
==== Template query
|
||||||
|
|
||||||
|
The `template` query has been deprecated in favour of the search template api. The `template` query is scheduled
|
||||||
|
to be removed in the next major version.
|
|
@ -23,6 +23,8 @@ import org.elasticsearch.common.ParsingException;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||||
|
import org.elasticsearch.common.logging.Loggers;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
|
@ -47,8 +49,12 @@ import java.util.Optional;
|
||||||
/**
|
/**
|
||||||
* Facilitates creating template query requests.
|
* Facilitates creating template query requests.
|
||||||
* */
|
* */
|
||||||
|
@Deprecated
|
||||||
|
// TODO remove this class in 6.0
|
||||||
public class TemplateQueryBuilder extends AbstractQueryBuilder<TemplateQueryBuilder> {
|
public class TemplateQueryBuilder extends AbstractQueryBuilder<TemplateQueryBuilder> {
|
||||||
|
|
||||||
public static final String NAME = "template";
|
public static final String NAME = "template";
|
||||||
|
private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(Loggers.getLogger(TemplateQueryBuilder.class));
|
||||||
|
|
||||||
/** Template to fill. */
|
/** Template to fill. */
|
||||||
private final Script template;
|
private final Script template;
|
||||||
|
@ -63,6 +69,7 @@ public class TemplateQueryBuilder extends AbstractQueryBuilder<TemplateQueryBuil
|
||||||
|
|
||||||
// for tests, so that mock script can be used:
|
// for tests, so that mock script can be used:
|
||||||
TemplateQueryBuilder(Script template) {
|
TemplateQueryBuilder(Script template) {
|
||||||
|
DEPRECATION_LOGGER.deprecated("[{}] query is deprecated, use search template api instead", NAME);
|
||||||
if (template == null) {
|
if (template == null) {
|
||||||
throw new IllegalArgumentException("query template cannot be null");
|
throw new IllegalArgumentException("query template cannot be null");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue