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

**URL:** <https://discuss.elastic.co/t/search-with-wildcard-on-index-and-simplequerystringquery-does-not-work-in-6-3-worked-in-2-4/147821>\
**Category:** Elasticsearch\
**Created:** [September 8, 2018, 2:31pm UTC](https://discuss.elastic.co/t/search-with-wildcard-on-index-and-simplequerystringquery-does-not-work-in-6-3-worked-in-2-4/147821 "2018-09-08T14:31:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbalaguero](https://avatars.discourse-cdn.com/v4/letter/j/c68b51/32.png) [@jbalaguero](https://discuss.elastic.co/u/jbalaguero)\
**Post date:** [September 8, 2018, 2:31pm UTC](https://discuss.elastic.co/t/search-with-wildcard-on-index-and-simplequerystringquery-does-not-work-in-6-3-worked-in-2-4/147821/1 "2018-09-08T14:31:12Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 6, 2018, 2:31pm UTC](https://discuss.elastic.co/t/search-with-wildcard-on-index-and-simplequerystringquery-does-not-work-in-6-3-worked-in-2-4/147821/2 "2018-10-06T14:31:17Z")

</div>

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