handle whitespace text on search fields query string parameter to be treated as no fields
This commit is contained in:
parent
aff8a4407f
commit
6d108e77f1
|
@ -25,6 +25,7 @@ import org.elasticsearch.action.search.SearchOperationThreading;
|
||||||
import org.elasticsearch.action.search.SearchRequest;
|
import org.elasticsearch.action.search.SearchRequest;
|
||||||
import org.elasticsearch.action.search.SearchResponse;
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
@ -183,7 +184,7 @@ public class RestSearchAction extends BaseRestHandler {
|
||||||
|
|
||||||
String sField = request.param("fields");
|
String sField = request.param("fields");
|
||||||
if (sField != null) {
|
if (sField != null) {
|
||||||
if (sField.length() == 0) {
|
if (!Strings.hasText(sField)) {
|
||||||
searchSourceBuilder.noFields();
|
searchSourceBuilder.noFields();
|
||||||
} else {
|
} else {
|
||||||
String[] sFields = fieldsPattern.split(sField);
|
String[] sFields = fieldsPattern.split(sField);
|
||||||
|
|
Loading…
Reference in New Issue