# QueryBuilders.queryString() does not seems to work properly for me

**URL:** https://discuss.elastic.co/t/querybuilders-querystring-does-not-seems-to-work-properly-for-me/5390
**Category:** Elasticsearch
**Created:** [September 15, 2011, 8:20pm UTC](https://discuss.elastic.co/t/querybuilders-querystring-does-not-seems-to-work-properly-for-me/5390 "2011-09-15T20:20:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![noor](https://avatars.discourse-cdn.com/v4/letter/n/c67d28/32.png) [@noor](https://discuss.elastic.co/u/noor)
#### Post date: [September 15, 2011, 8:20pm UTC](https://discuss.elastic.co/t/querybuilders-querystring-does-not-seems-to-work-properly-for-me/5390/1 "2011-09-15T20:20:22Z")

</div>

Hi,

I had indexed two documents named "tweet" under "default" index. where  
each tweet document has a property named "message" which contains two  
different paragraphs that I got from some web site. After successfully  
adding them to elastic search when try to query then using below code  
snippet I do not get any result when I pass_was_ or _of_ in  
queryString as my search terms but when I pass _in_ or even _is_ I get  
both documents in result. All the search terms that I had mentioned  
earlier exists in both documents could anyone please explain what is  
the actual problem.

SearchResponse response = client.prepareSearch("default")  
.setSearchType(SearchType.DFS\_QUERY\_THEN\_FETCH)  
.setQuery(QueryBuilders.queryString("_was_"))  
.setFrom(0).setSize(60).setExplain(false)  
.execute()  
.actionGet();

---

<div class="post-metadata">

### Author: ![noor](https://avatars.discourse-cdn.com/v4/letter/n/c67d28/32.png) [@noor](https://discuss.elastic.co/u/noor)
#### Post date: [September 16, 2011, 5:49am UTC](https://discuss.elastic.co/t/querybuilders-querystring-does-not-seems-to-work-properly-for-me/5390/2 "2011-09-16T05:49:41Z")

</div>

Even below code is not working ☹

```
SearchResponse response =

```

client.prepareSearch("default").setTypes("Tweet")  
.setSearchType(SearchType.DFS\_QUERY\_THEN\_FETCH)  
.setQuery(QueryBuilders.wildcardQuery("message","_was_"))  
.setFrom(0).setSize(60).setExplain(false)  
.execute()  
.actionGet();

---

<div class="post-metadata">

### Author: ![Jan\_Fiedler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jan_fiedler/32/2518_2.png) [@Jan\_Fiedler](https://discuss.elastic.co/u/Jan_Fiedler)
#### Post date: [September 16, 2011, 2:32pm UTC](https://discuss.elastic.co/t/querybuilders-querystring-does-not-seems-to-work-properly-for-me/5390/3 "2011-09-16T14:32:31Z")

</div>

I would assume you do not have a mapping setup (relying on default mapping).  
This would mean your message is analyzed with the standard analyzer. This  
would mean that - by default - English stop words would be removed from your  
content. I did not check but would assume that 'was' is considered a stop  
word. Please try your query with a term that is not a stopword AND remove  
the wildcards (they are not required with a full text search engine).

---

<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: [July 6, 2017, 3:54am UTC](https://discuss.elastic.co/t/querybuilders-querystring-does-not-seems-to-work-properly-for-me/5390/4 "2017-07-06T03:54:18Z")

</div>


