# Multiple word queries not returning any results

**URL:** <https://discuss.elastic.co/t/multiple-word-queries-not-returning-any-results/13074>\
**Category:** Elasticsearch\
**Created:** [August 5, 2013, 3:21pm UTC](https://discuss.elastic.co/t/multiple-word-queries-not-returning-any-results/13074 "2013-08-05T15:21:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Slater\_Victoroff\_2](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Slater\_Victoroff\_2](https://discuss.elastic.co/u/Slater_Victoroff_2)\
**Post date:** [August 5, 2013, 3:21pm UTC](https://discuss.elastic.co/t/multiple-word-queries-not-returning-any-results/13074/1 "2013-08-05T15:21:37Z")

</div>

Sorry if I'm doing something silly, but for some reason I'm not getting any  
results for multi-word queries. Everything works perfectly fine when I  
search for single words, but the second I add a space everything breaks  
down. My settings file is up here:

> <https://gist.github.com/Slater-Victoroff/6156734>

And the actual query I'm sending in is:

{'query': {'term': {'searchable\_text': u'huge capacitor'}},  
'suggest': {'searchable\_text\_suggestions': {'term': {'field': 'searchable\_text',  
'max\_term\_freq': '2',  
'size': '2'},  
'text': u'huge capacitor'}}}

To the url:

[http://localhost:9200/index-1,index-2,index-3/\_search](http://localhost:9200/index-1,index-2,index-3/_search)

I'm sending the data with a get request.

Am I doing something silly here? The suggestion results come back perfectly fine, I just never get any search results.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [August 5, 2013, 3:33pm UTC](https://discuss.elastic.co/t/multiple-word-queries-not-returning-any-results/13074/2 "2013-08-05T15:33:05Z")

</div>

Term queries aren't analyzed so it is looking for the exact term "huge  
capacitor" which _might_ find something given that it looks like you using  
a shingle filter but normally I'd use a query string or phrase search to  
look for multiple words.

On Mon, Aug 5, 2013 at 11:21 AM, Slater Victoroff [svictoroff@edx.org](mailto:svictoroff@edx.org)wrote:

> Sorry if I'm doing something silly, but for some reason I'm not getting  
> any results for multi-word queries. Everything works perfectly fine when I  
> search for single words, but the second I add a space everything breaks  
> down. My settings file is up here:  
> [ElasticSearch Settings file · GitHub](https://gist.github.com/Slater-Victoroff/6156734)
> 
> And the actual query I'm sending in is:
> 
> {'query': {'term': {'searchable\_text': u'huge capacitor'}},  
> 'suggest': {'searchable\_text\_suggestions': {'term': {'field': 'searchable\_text',  
> 'max\_term\_freq': '2',  
> 'size': '2'},  
> 'text': u'huge capacitor'}}}
> 
> To the url:
> 
> [http://localhost:9200/index-1,index-2,index-3/\_search](http://localhost:9200/index-1,index-2,index-3/_search)
> 
> I'm sending the data with a get request.
> 
> Am I doing something silly here? The suggestion results come back perfectly fine, I just never get any search results.
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Slater\_Victoroff\_2](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Slater\_Victoroff\_2](https://discuss.elastic.co/u/Slater_Victoroff_2)\
**Post date:** [August 5, 2013, 3:44pm UTC](https://discuss.elastic.co/t/multiple-word-queries-not-returning-any-results/13074/3 "2013-08-05T15:44:09Z")

</div>

I changed my query to:

{'query\_string': {'default\_field': 'searchable\_text', 'query': u'huge capacitor'},  
'suggest': {'searchable\_text\_suggestions': {'term': {'field': 'searchable\_text',  
'max\_term\_freq': '1',  
'size': '2'},

'text': u'huge capacitor'}}}

But I'm getting an error on query\_string. Sorry, I haven't used query  
strings before. I tried just following this example:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

It looks like I've done something wrong though, is there a better place to  
look for constructing query strings?

On Monday, August 5, 2013 11:33:05 AM UTC-4, Nikolas Everett wrote:

> Term queries aren't analyzed so it is looking for the exact term "huge  
> capacitor" which _might_ find something given that it looks like you using  
> a shingle filter but normally I'd use a query string or phrase search to  
> look for multiple words.
> 
> On Mon, Aug 5, 2013 at 11:21 AM, Slater Victoroff \<[svict...@edx.org](mailto:svict...@edx.org)\<javascript:\>
> 
> > wrote:
> 
> > Sorry if I'm doing something silly, but for some reason I'm not getting  
> > any results for multi-word queries. Everything works perfectly fine when I  
> > search for single words, but the second I add a space everything breaks  
> > down. My settings file is up here:  
> > [ElasticSearch Settings file · GitHub](https://gist.github.com/Slater-Victoroff/6156734)
> > 
> > And the actual query I'm sending in is:
> > 
> > {'query': {'term': {'searchable\_text': u'huge capacitor'}},  
> > 'suggest': {'searchable\_text\_suggestions': {'term': {'field': 'searchable\_text',  
> > 'max\_term\_freq': '2',  
> > 'size': '2'},  
> > 'text': u'huge capacitor'}}}
> > 
> > To the url:
> > 
> > [http://localhost:9200/index-1,index-2,index-3/\_search](http://localhost:9200/index-1,index-2,index-3/_search)
> > 
> > I'm sending the data with a get request.
> > 
> > Am I doing something silly here? The suggestion results come back perfectly fine, I just never get any search results.
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Slater\_Victoroff\_2](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Slater\_Victoroff\_2](https://discuss.elastic.co/u/Slater_Victoroff_2)\
**Post date:** [August 5, 2013, 3:50pm UTC](https://discuss.elastic.co/t/multiple-word-queries-not-returning-any-results/13074/4 "2013-08-05T15:50:07Z")

</div>

Ah, sorry, I figured it out, didn't realize it had to be a part of a query  
itself. Many thanks for pointing me in the right direction! This was the  
query I ended up with:

{'query': {'text': {'searchable\_text': u'huge capacitor'}},  
'suggest': {'searchable\_text\_suggestions': {'term': {'field': 'searchable\_text',  
'max\_term\_freq': '1',  
'size': '2'},  
'text': u'huge capacitor'}}}

On Monday, August 5, 2013 11:44:09 AM UTC-4, Slater Victoroff wrote:

> I changed my query to:
> 
> {'query\_string': {'default\_field': 'searchable\_text', 'query': u'huge capacitor'},  
> 'suggest': {'searchable\_text\_suggestions': {'term': {'field': 'searchable\_text',  
> 'max\_term\_freq': '1',  
> 'size': '2'},
> 
> 'text': u'huge capacitor'}}}
> 
> But I'm getting an error on query\_string. Sorry, I haven't used query  
> strings before. I tried just following this example:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query/)
> 
> It looks like I've done something wrong though, is there a better place to  
> look for constructing query strings?
> 
> On Monday, August 5, 2013 11:33:05 AM UTC-4, Nikolas Everett wrote:
> 
> > Term queries aren't analyzed so it is looking for the exact term "huge  
> > capacitor" which _might_ find something given that it looks like you using  
> > a shingle filter but normally I'd use a query string or phrase search to  
> > look for multiple words.
> > 
> > On Mon, Aug 5, 2013 at 11:21 AM, Slater Victoroff [svict...@edx.org](mailto:svict...@edx.org)wrote:
> > 
> > > Sorry if I'm doing something silly, but for some reason I'm not getting  
> > > any results for multi-word queries. Everything works perfectly fine when I  
> > > search for single words, but the second I add a space everything breaks  
> > > down. My settings file is up here:  
> > > [ElasticSearch Settings file · GitHub](https://gist.github.com/Slater-Victoroff/6156734)
> > > 
> > > And the actual query I'm sending in is:
> > > 
> > > {'query': {'term': {'searchable\_text': u'huge capacitor'}},  
> > > 'suggest': {'searchable\_text\_suggestions': {'term': {'field': 'searchable\_text',  
> > > 'max\_term\_freq': '2',  
> > > 'size': '2'},  
> > > 'text': u'huge capacitor'}}}
> > > 
> > > To the url:
> > > 
> > > [http://localhost:9200/index-1,index-2,index-3/\_search](http://localhost:9200/index-1,index-2,index-3/_search)
> > > 
> > > I'm sending the data with a get request.
> > > 
> > > Am I doing something silly here? The suggestion results come back perfectly fine, I just never get any search results.
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:22am UTC](https://discuss.elastic.co/t/multiple-word-queries-not-returning-any-results/13074/5 "2017-07-06T02:22:50Z")

</div>


