java: QueryBuilders cleanup: remove deprecated

Related to #8667:

Some QueryBuilders have been deprecated in 1.x branches. We removed them in 2.0.

Removed
-------

* `textPhrase(...)`
* `textPhrasePrefix(...)`
* `textPhrasePrefixQuery(...)`
* `filtered(...)`
* `inQuery(...)`
* `commonTerms(...)`
* `queryString(...)`
* `simpleQueryString(...)`

Closes #8721.
This commit is contained in:
David Pilato 2014-11-26 15:24:23 +01:00
parent f37355a427
commit d2a2d1bb53
2 changed files with 15 additions and 168 deletions

View File

@ -88,3 +88,18 @@ with values in a single array.
] ]
} }
--------------- ---------------
=== Java API
Some query builders have been removed or renamed:
* `commonTerms(...)` renamed with `commonTermsQuery(...)`
* `queryString(...)` renamed with `queryStringQuery(...)`
* `simpleQueryString(...)` renamed with `simpleQueryStringQuery(...)`
* `textPhrase(...)` removed
* `textPhrasePrefix(...)` removed
* `textPhrasePrefixQuery(...)` removed
* `filtered(...)` removed. Use `filteredQuery(...)` instead.
* `inQuery(...)` removed.

View File

@ -50,15 +50,6 @@ public abstract class QueryBuilders {
return new MatchQueryBuilder(name, text).type(MatchQueryBuilder.Type.BOOLEAN); return new MatchQueryBuilder(name, text).type(MatchQueryBuilder.Type.BOOLEAN);
} }
/**
* @deprecated by commonTermsQuery(String, Object)
* Will be removed in elasticsearch 2.0.0
*/
@Deprecated
public static CommonTermsQueryBuilder commonTerms(String name, Object text) {
return commonTermsQuery(name, text);
}
/** /**
* Creates a common query for the provided field name and text. * Creates a common query for the provided field name and text.
* *
@ -79,29 +70,6 @@ public abstract class QueryBuilders {
return new MultiMatchQueryBuilder(text, fieldNames); // BOOLEAN is the default return new MultiMatchQueryBuilder(text, fieldNames); // BOOLEAN is the default
} }
/**
* Creates a text query with type "PHRASE" for the provided field name and text.
*
* @param name The field name.
* @param text The query text (to be analyzed).
* @deprecated use {@link #textPhraseQuery(String, Object)} instead
* Will be removed in elasticsearch 2.0.0
*/
public static MatchQueryBuilder textPhrase(String name, Object text) {
return textPhraseQuery(name, text);
}
/**
* Creates a text query with type "PHRASE" for the provided field name and text.
*
* @param name The field name.
* @param text The query text (to be analyzed).
* @deprecated Use {@link #matchPhraseQuery(String, Object)}
*/
public static MatchQueryBuilder textPhraseQuery(String name, Object text) {
return new MatchQueryBuilder(name, text).type(MatchQueryBuilder.Type.PHRASE);
}
/** /**
* Creates a text query with type "PHRASE" for the provided field name and text. * Creates a text query with type "PHRASE" for the provided field name and text.
* *
@ -112,30 +80,6 @@ public abstract class QueryBuilders {
return new MatchQueryBuilder(name, text).type(MatchQueryBuilder.Type.PHRASE); return new MatchQueryBuilder(name, text).type(MatchQueryBuilder.Type.PHRASE);
} }
/**
* Creates a text query with type "PHRASE_PREFIX" for the provided field name and text.
*
* @param name The field name.
* @param text The query text (to be analyzed).
* @deprecated use {@link #textPhrasePrefixQuery(String, Object)} instead
* Will be removed in elasticsearch 2.0.0
*/
public static MatchQueryBuilder textPhrasePrefix(String name, Object text) {
return textPhrasePrefixQuery(name, text);
}
/**
* Creates a text query with type "PHRASE_PREFIX" for the provided field name and text.
*
* @param name The field name.
* @param text The query text (to be analyzed).
* @deprecated Use {@link #matchPhrasePrefixQuery(String, Object)}
* Will be removed in elasticsearch 2.0.0
*/
public static MatchQueryBuilder textPhrasePrefixQuery(String name, Object text) {
return new MatchQueryBuilder(name, text).type(MatchQueryBuilder.Type.PHRASE_PREFIX);
}
/** /**
* Creates a match query with type "PHRASE_PREFIX" for the provided field name and text. * Creates a match query with type "PHRASE_PREFIX" for the provided field name and text.
* *
@ -299,14 +243,6 @@ public abstract class QueryBuilders {
return new RegexpQueryBuilder(name, regexp); return new RegexpQueryBuilder(name, regexp);
} }
/**
* @deprecated by queryStringQuery(String)
*/
@Deprecated
public static QueryStringQueryBuilder queryString(String queryString) {
return queryStringQuery(queryString);
}
/** /**
* A query that parses a query string and runs it. There are two modes that this operates. The first, * A query that parses a query string and runs it. There are two modes that this operates. The first,
* when no field is added (using {@link QueryStringQueryBuilder#field(String)}, will run the query once and non prefixed fields * when no field is added (using {@link QueryStringQueryBuilder#field(String)}, will run the query once and non prefixed fields
@ -320,14 +256,6 @@ public abstract class QueryBuilders {
return new QueryStringQueryBuilder(queryString); return new QueryStringQueryBuilder(queryString);
} }
/**
* @deprecated by simpleQueryStringQuery(String)
*/
@Deprecated
public static SimpleQueryStringBuilder simpleQueryString(String queryString) {
return simpleQueryStringQuery(queryString);
}
/** /**
* A query that acts similar to a query_string query, but won't throw * A query that acts similar to a query_string query, but won't throw
* exceptions for any weird string syntax. See * exceptions for any weird string syntax. See
@ -408,18 +336,6 @@ public abstract class QueryBuilders {
return new FieldMaskingSpanQueryBuilder(query, field); return new FieldMaskingSpanQueryBuilder(query, field);
} }
/**
* A query that applies a filter to the results of another query.
*
* @param queryBuilder The query to apply the filter to
* @param filterBuilder The filter to apply on the query
* @deprecated Use filteredQuery instead (rename)
* Will be removed in elasticsearch 2.0.0
*/
public static FilteredQueryBuilder filtered(QueryBuilder queryBuilder, @Nullable FilterBuilder filterBuilder) {
return new FilteredQueryBuilder(queryBuilder, filterBuilder);
}
/** /**
* A query that applies a filter to the results of another query. * A query that applies a filter to the results of another query.
* *
@ -658,90 +574,6 @@ public abstract class QueryBuilders {
return new TermsQueryBuilder(name, values); return new TermsQueryBuilder(name, values);
} }
/**
* A filer for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
* @deprecated not used
* Will be removed in elasticsearch 2.0.0
*/
public static TermsQueryBuilder inQuery(String name, String... values) {
return new TermsQueryBuilder(name, values);
}
/**
* A filer for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
* @deprecated not used
* Will be removed in elasticsearch 2.0.0
*/
public static TermsQueryBuilder inQuery(String name, int... values) {
return new TermsQueryBuilder(name, values);
}
/**
* A filer for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
* @deprecated not used
* Will be removed in elasticsearch 2.0.0
*/
public static TermsQueryBuilder inQuery(String name, long... values) {
return new TermsQueryBuilder(name, values);
}
/**
* A filer for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
* @deprecated not used
* Will be removed in elasticsearch 2.0.0
*/
public static TermsQueryBuilder inQuery(String name, float... values) {
return new TermsQueryBuilder(name, values);
}
/**
* A filer for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
* @deprecated not used
* Will be removed in elasticsearch 2.0.0
*/
public static TermsQueryBuilder inQuery(String name, double... values) {
return new TermsQueryBuilder(name, values);
}
/**
* A filer for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
* @deprecated not used
* Will be removed in elasticsearch 2.0.0
*/
public static TermsQueryBuilder inQuery(String name, Object... values) {
return new TermsQueryBuilder(name, values);
}
/**
* A filer for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
* @deprecated not used
* Will be removed in elasticsearch 2.0.0
*/
public static TermsQueryBuilder inQuery(String name, Collection<?> values) {
return new TermsQueryBuilder(name, values);
}
/** /**
* A query that will execute the wrapped query only for the specified indices, and "match_all" when * A query that will execute the wrapped query only for the specified indices, and "match_all" when
* it does not match those indices. * it does not match those indices.