QueryParser in Lucene 5.5.0 not returning same results as in 4.10.4

Hi,
I am upgrading our elastic 1.5.2 with lucene 4.10.4 to elastic 2.3 with lucene 5.5.0.

when searching for “hello world” in old system, I got only documents with the exact phrase “hello world”, while in the new one I get also documents with “hello” and/or “world”.

While debugging I saw that the problematic line is:
final Query luceneQuery = qp.parse(queryString); *

In the old system, luceneQuery value after this line is:
_field:"hello world"
and later the query was:
{"query_string":{"query":""hello world"","fields":["title","topic"],"use_dis_max":false,"analyzer":"hebrew_query_light"}}

In the new system, its:
_field:"(hello$ hello) (world$ world)"
later on, the query is:
{"bool":{"must":{"multi_match":{"query":""(hello$ hello) (world$ world)"","fields":["title.hebrew_query_light","topic.hebrew_query_light"]}}}}

How can I force QueryParser to be _field:"hello world"?

  • Taken from next lines:
    String parsingDummyFieldName = "_field";
    final Map<String, Analyzer> analyzerMap = new HashMap<>(3);
    hebrewAnalyzer = new HebrewQueryAnalyzer(DictReceiver.getDictionary());
    analyzerMap.put("title", hebrewAnalyzer);
    analyzerMap.put("topic", hebrewAnalyzer);
    analyzerMap.put(parsingDummyFieldName, hebrewAnalyzer);
    perFieldAnalyzerWrapper = new PerFieldAnalyzerWrapper(new KeywordAnalyzer(), analyzerMap);
    org.apache.lucene.queryparser.classic.QueryParser qp = new org.apache.lucene.queryparser.classic.QueryParser(
    parsingDummyFieldName, perFieldAnalyzerWrapper);
    qp.setDefaultOperator(org.apache.lucene.queryparser.classic.QueryParser.Operator.AND);
    qp.setAllowLeadingWildcard(false);

QueryBuilder queryBuilder;
final Query luceneQuery = qp.parse(queryString);

Thanks