Search with wildcard on index and simpleQueryStringQuery does not work in 6.3 (worked in 2.4)

Hello,

I have the following 'SearchRequest', querying all indexes whose names start with '72_' and searching for those documents where " end <= '20180830' ". I only need to get the list of document ids that match this query.

SearchRequest{searchType=QUERY_THEN_FETCH, indices=[72_*], indicesOptions=IndicesOptions[id=38, ignore_unavailable=false, allow_no_indices=true, expand_wildcards_open=true, expand_wildcards_closed=false, allow_aliases_to_multiple_indices=true, forbid_closed_indices=true, ignore_aliases=false], types=[], routing='null', preference='null', requestCache=null, scroll=Scroll{keepAlive=10s}, maxConcurrentShardRequests=0, batchedReduceSize=512, preFilterShardSize=128, allowPartialSearchResults=null, source={"size":3000,"query":{"simple_query_string":{"query":"{ "query" : { "bool" : { "filter" : [ { "range" : { "end": { "lte": "20180830" } } } ] }} }","flags":-1,"default_operator":"or","analyze_wildcard":false,"auto_generate_synonyms_phrase_query":true,"fuzzy_prefix_length":0,"fuzzy_max_expansions":50,"fuzzy_transpositions":true,"boost":1.0}},"version":false,"_source":false,"sort":[{"_doc":{"order":"asc"}}]}}

If I perform this search from java:

SearchRequest scanRequest = new SearchRequest("72_*").
	  								  scroll("10s").
	  								  source(new SearchSourceBuilder().
  										   	  	 fetchSource(false).
  										   	  	 query(QueryBuilders.simpleQueryStringQuery("{ \"query\" : { \"bool\" : { \"filter\" : [ { \"range\" : { \"end\": { \"lte\": \"20180830\" } } }]}}}")).
												 size(3000).
												 sort("_doc").
												 version(false));

I get 0 results.

If I perform a count using the same query from console, I correctly get results:

[root@server02 bin]# curl -XGET -H 'Content-Type: application/json' --data '{"query":{"bool":{"filter":[{"range":{"end":{"lte":"20180830"}}}]}}}' http://127.0.0.1:92
00/72_*/_count
{"count":2359,"_shards":{"total":4,"successful":4,"skipped":0,"failed":0}}

There is something wrong in how I'm building the query from java, but I'm not able to see what. This worked with ES 2.4.1. I suspect the issue is in the 'simpleQueryStringQuery' (something must be changed from 2.4.1). This example is a range query, but it can be of any kind.

Thanks,
Joan.

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