allow to set a query using a string as well
This commit is contained in:
parent
42b2e60af2
commit
c050bb58da
|
@ -171,6 +171,14 @@ public class SearchRequestBuilder extends BaseRequestBuilder<SearchRequest, Sear
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new search source builder with a raw search query.
|
||||||
|
*/
|
||||||
|
public SearchRequestBuilder setQuery(String query) {
|
||||||
|
sourceBuilder().query(query);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new search source builder with a raw search query.
|
* Constructs a new search source builder with a raw search query.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
package org.elasticsearch.search.builder;
|
package org.elasticsearch.search.builder;
|
||||||
|
|
||||||
|
import org.elasticsearch.common.Unicode;
|
||||||
import org.elasticsearch.common.collect.Lists;
|
import org.elasticsearch.common.collect.Lists;
|
||||||
import org.elasticsearch.common.io.FastByteArrayOutputStream;
|
import org.elasticsearch.common.io.FastByteArrayOutputStream;
|
||||||
import org.elasticsearch.common.trove.TObjectFloatHashMap;
|
import org.elasticsearch.common.trove.TObjectFloatHashMap;
|
||||||
|
@ -112,6 +113,14 @@ public class SearchSourceBuilder implements ToXContent {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new search source builder with a raw search query.
|
||||||
|
*/
|
||||||
|
public SearchSourceBuilder query(String queryString) {
|
||||||
|
this.queryBinary = Unicode.fromStringAsBytes(queryString);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* From index to start the search from. Defaults to <tt>0</tt>.
|
* From index to start the search from. Defaults to <tt>0</tt>.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue