Setting default operator to AND in elasticsearch when using SearchSourceBuilder and XContentParser

I have the below sample code to query elasticsearch. It receives the user query and uses XContentParser and SearchSourceBuilder. I don't want to tweak a lot on the existing code as it is has been in production for a while. I would like to change the default operator from "OR" to "AND" so we get more meaningful messages. I couldn't find a way to set the default operator in this scenario. Any help apprecaited

String[] indicesArray={"index1","index2"};
String fullQueryJson={"query":{"nested":{"path":"_ROOT","query":{"query_string":{"query":"_ROOT.LATEST.FULL_NAME:John Mary C"}}}},"_source":["FULL_NAME","TEXT_MSG","USER_NAME"],"size":9010}

SearchSourceBuilder accessSearchSource = new SearchSourceBuilder();
final SearchModule searchModule = new SearchModule(Settings.EMPTY, false, Collections.emptyList());
final XContentParser fullQueryJsonParser = XContentFactory.xContent(XContentType.JSON)
                    .createParser(new NamedXContentRegistry(searchModule.getNamedXContents()), LoggingDeprecationHandler.INSTANCE, fullQueryJson);
SearchRequest request=new SearchRequest(indicesArray);

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.