diff --git a/src/main/java/org/elasticsearch/action/suggest/SuggestRequest.java b/src/main/java/org/elasticsearch/action/suggest/SuggestRequest.java index b443ac5ca96..8dbd8e2f8e0 100644 --- a/src/main/java/org/elasticsearch/action/suggest/SuggestRequest.java +++ b/src/main/java/org/elasticsearch/action/suggest/SuggestRequest.java @@ -38,8 +38,8 @@ import org.elasticsearch.common.xcontent.XContentType; * A request to get suggestions for corrections of phrases. Best created with * {@link org.elasticsearch.client.Requests#suggestRequest(String...)}. *

- *

The request requires the query source to be set either using {@link #query(org.elasticsearch.index.query.QueryBuilder)}, - * or {@link #query(byte[])}. + *

The request requires the suggest query source to be set either using {@link #suggest(org.elasticsearch.common.bytes.BytesReference)}, + * or {@link #suggest(org.elasticsearch.common.bytes.BytesReference, boolean)}. * * @see SuggestResponse * @see org.elasticsearch.client.Client#suggest(SuggestRequest) diff --git a/src/main/java/org/elasticsearch/client/Requests.java b/src/main/java/org/elasticsearch/client/Requests.java index 9ae732310ad..2c1a9f090a2 100644 --- a/src/main/java/org/elasticsearch/client/Requests.java +++ b/src/main/java/org/elasticsearch/client/Requests.java @@ -61,6 +61,7 @@ import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.mlt.MoreLikeThisRequest; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchScrollRequest; +import org.elasticsearch.action.suggest.SuggestRequest; import org.elasticsearch.common.xcontent.XContentType; /** @@ -161,6 +162,16 @@ public class Requests { return new ExistsRequest(indices); } + /** + * Creates a suggest request for getting suggestions from provided indices. + * The suggest query has to be set using the JSON source using {@link org.elasticsearch.action.suggest.SuggestRequest#suggest(org.elasticsearch.common.bytes.BytesReference)}. + * @param indices The indices to suggest from. Use null or _all to execute against all indices + * @see org.elasticsearch.client.Client#suggest(org.elasticsearch.action.suggest.SuggestRequest) + */ + public static SuggestRequest suggestRequest(String... indices) { + return new SuggestRequest(indices); + } + /** * More like this request represents a request to search for documents that are "like" the provided (fetched) * document.