# Boost the first word in a multi-word query

**URL:** <https://discuss.elastic.co/t/boost-the-first-word-in-a-multi-word-query/19406>\
**Category:** Elasticsearch\
**Created:** [August 22, 2014, 9:58am UTC](https://discuss.elastic.co/t/boost-the-first-word-in-a-multi-word-query/19406 "2014-08-22T09:58:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeremy\_3](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jeremy\_3](https://discuss.elastic.co/u/Jeremy_3)\
**Post date:** [August 22, 2014, 9:58am UTC](https://discuss.elastic.co/t/boost-the-first-word-in-a-multi-word-query/19406/1 "2014-08-22T09:58:48Z")

</div>

In case of a multi-word query, is there a way to boost the first terms of  
the query?

For example, in the following query:  
GET /my\_index/my\_type/\_search  
{  
"query": {  
"match": {  
"title": "BROWN DOG!"  
}  
}  
}

"Brown" should be prioritized over "dog", therefore searching for "brown  
dog" will not return the same scores as searching for "dog brown".  
I'm ideally looking for a solution which work with N words and put weight  
accordingly the number of words.

Regards,  
Jeremy

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)\
**Post date:** [August 22, 2014, 6:20pm UTC](https://discuss.elastic.co/t/boost-the-first-word-in-a-multi-word-query/19406/2 "2014-08-22T18:20:54Z")

</div>

Hello Jeremy ,

I feel what you are looking for is a phrase query . It takes into  
consideration the order of words -

> **[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.

Thanks  
Vineeth

On Fri, Aug 22, 2014 at 3:28 PM, Jeremy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:

> In case of a multi-word query, is there a way to boost the first terms of  
> the query?
> 
> For example, in the following query:  
> GET /my\_index/my\_type/\_search  
> {  
> "query": {  
> "match": {  
> "title": "BROWN DOG!"  
> }  
> }  
> }
> 
> "Brown" should be prioritized over "dog", therefore searching for "brown  
> dog" will not return the same scores as searching for "dog brown".  
> I'm ideally looking for a solution which work with N words and put weight  
> accordingly the number of words.
> 
> Regards,  
> Jeremy
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC\_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Jeremy\_3](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jeremy\_3](https://discuss.elastic.co/u/Jeremy_3)\
**Post date:** [August 22, 2014, 6:41pm UTC](https://discuss.elastic.co/t/boost-the-first-word-in-a-multi-word-query/19406/3 "2014-08-22T18:41:18Z")

</div>

Thanks for your answer!

Unfortunately the phrase query is not enough, because I still want to keep  
words optional. In my understanding, the phrase query requires all the  
words of the query to be present.

Cheers,  
Jeremy

On Fri, Aug 22, 2014 at 8:20 PM, vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com)  
wrote:

> Hello Jeremy ,
> 
> I feel what you are looking for is a phrase query . It takes into  
> consideration the order of words -  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#_phrase)
> 
> Thanks  
> Vineeth
> 
> On Fri, Aug 22, 2014 at 3:28 PM, Jeremy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:
> 
> > In case of a multi-word query, is there a way to boost the first terms of  
> > the query?
> > 
> > For example, in the following query:  
> > GET /my\_index/my\_type/\_search  
> > {  
> > "query": {  
> > "match": {  
> > "title": "BROWN DOG!"  
> > }  
> > }  
> > }
> > 
> > "Brown" should be prioritized over "dog", therefore searching for "brown  
> > dog" will not return the same scores as searching for "dog brown".  
> > I'm ideally looking for a solution which work with N words and put weight  
> > accordingly the number of words.
> > 
> > Regards,  
> > Jeremy
> > 
> > --  
> > 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).
> > 
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC\_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC\_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)\
**Post date:** [August 22, 2014, 6:50pm UTC](https://discuss.elastic.co/t/boost-the-first-word-in-a-multi-word-query/19406/4 "2014-08-22T18:50:52Z")

</div>

Hello Jeremy ,

You can try query\_string then.

Query as "Brown^2 dog"

> **[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.

Thanks  
Vineeth

On Sat, Aug 23, 2014 at 12:11 AM, Jérémy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:

> Thanks for your answer!
> 
> Unfortunately the phrase query is not enough, because I still want to keep  
> words optional. In my understanding, the phrase query requires all the  
> words of the query to be present.
> 
> Cheers,  
> Jeremy
> 
> On Fri, Aug 22, 2014 at 8:20 PM, vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com)  
> wrote:
> 
> > Hello Jeremy ,
> > 
> > I feel what you are looking for is a phrase query . It takes into  
> > consideration the order of words -  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#_phrase)
> > 
> > Thanks  
> > Vineeth
> > 
> > On Fri, Aug 22, 2014 at 3:28 PM, Jeremy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:
> > 
> > > In case of a multi-word query, is there a way to boost the first terms  
> > > of the query?
> > > 
> > > For example, in the following query:  
> > > GET /my\_index/my\_type/\_search  
> > > {  
> > > "query": {  
> > > "match": {  
> > > "title": "BROWN DOG!"  
> > > }  
> > > }  
> > > }
> > > 
> > > "Brown" should be prioritized over "dog", therefore searching for "brown  
> > > dog" will not return the same scores as searching for "dog brown".  
> > > I'm ideally looking for a solution which work with N words and put  
> > > weight accordingly the number of words.
> > > 
> > > Regards,  
> > > Jeremy
> > > 
> > > --  
> > > 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).
> > > 
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC\_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC\_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Jeremy\_3](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jeremy\_3](https://discuss.elastic.co/u/Jeremy_3)\
**Post date:** [August 24, 2014, 7:27pm UTC](https://discuss.elastic.co/t/boost-the-first-word-in-a-multi-word-query/19406/5 "2014-08-24T19:27:38Z")

</div>

Thanks Vineeth, I can certainly build something with the query string 🙂

On Fri, Aug 22, 2014 at 8:50 PM, vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com)  
wrote:

> Hello Jeremy ,
> 
> You can try query\_string then.
> 
> Query as "Brown^2 dog"
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-dsl-query-string-query)
> 
> Thanks  
> Vineeth
> 
> On Sat, Aug 23, 2014 at 12:11 AM, Jérémy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:
> 
> > Thanks for your answer!
> > 
> > Unfortunately the phrase query is not enough, because I still want to  
> > keep words optional. In my understanding, the phrase query requires all the  
> > words of the query to be present.
> > 
> > Cheers,  
> > Jeremy
> > 
> > On Fri, Aug 22, 2014 at 8:20 PM, vineeth mohan \<[vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com)
> > 
> > > wrote:
> > 
> > > Hello Jeremy ,
> > > 
> > > I feel what you are looking for is a phrase query . It takes into  
> > > consideration the order of words -  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#_phrase)
> > > 
> > > Thanks  
> > > Vineeth
> > > 
> > > On Fri, Aug 22, 2014 at 3:28 PM, Jeremy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:
> > > 
> > > > In case of a multi-word query, is there a way to boost the first terms  
> > > > of the query?
> > > > 
> > > > For example, in the following query:  
> > > > GET /my\_index/my\_type/\_search  
> > > > {  
> > > > "query": {  
> > > > "match": {  
> > > > "title": "BROWN DOG!"  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > "Brown" should be prioritized over "dog", therefore searching for  
> > > > "brown dog" will not return the same scores as searching for "dog brown".  
> > > > I'm ideally looking for a solution which work with N words and put  
> > > > weight accordingly the number of words.
> > > > 
> > > > Regards,  
> > > > Jeremy
> > > > 
> > > > --  
> > > > 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).
> > > > 
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC\_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC\_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > 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).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwSTADYKzJo0HsxrLhpTteDYMDT-dkFcDHB8GZSmJ3\_MA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwSTADYKzJo0HsxrLhpTteDYMDT-dkFcDHB8GZSmJ3_MA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)\
**Post date:** [August 25, 2014, 3:23am UTC](https://discuss.elastic.co/t/boost-the-first-word-in-a-multi-word-query/19406/6 "2014-08-25T03:23:15Z")

</div>

Hello Jeremy ,

Just a word of caution.  
Its not reccomonded to expose query\_string to end user.  
Rather another version of it used instead -

> **[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.

Thanks  
Vineeth

On Mon, Aug 25, 2014 at 12:57 AM, Jérémy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:

> Thanks Vineeth, I can certainly build something with the query string 🙂
> 
> On Fri, Aug 22, 2014 at 8:50 PM, vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com)  
> wrote:
> 
> > Hello Jeremy ,
> > 
> > You can try query\_string then.
> > 
> > Query as "Brown^2 dog"
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-dsl-query-string-query)
> > 
> > Thanks  
> > Vineeth
> > 
> > On Sat, Aug 23, 2014 at 12:11 AM, Jérémy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:
> > 
> > > Thanks for your answer!
> > > 
> > > Unfortunately the phrase query is not enough, because I still want to  
> > > keep words optional. In my understanding, the phrase query requires all the  
> > > words of the query to be present.
> > > 
> > > Cheers,  
> > > Jeremy
> > > 
> > > On Fri, Aug 22, 2014 at 8:20 PM, vineeth mohan \<  
> > > [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com)\> wrote:
> > > 
> > > > Hello Jeremy ,
> > > > 
> > > > I feel what you are looking for is a phrase query . It takes into  
> > > > consideration the order of words -  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#_phrase)
> > > > 
> > > > Thanks  
> > > > Vineeth
> > > > 
> > > > On Fri, Aug 22, 2014 at 3:28 PM, Jeremy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:
> > > > 
> > > > > In case of a multi-word query, is there a way to boost the first terms  
> > > > > of the query?
> > > > > 
> > > > > For example, in the following query:  
> > > > > GET /my\_index/my\_type/\_search  
> > > > > {  
> > > > > "query": {  
> > > > > "match": {  
> > > > > "title": "BROWN DOG!"  
> > > > > }  
> > > > > }  
> > > > > }
> > > > > 
> > > > > "Brown" should be prioritized over "dog", therefore searching for  
> > > > > "brown dog" will not return the same scores as searching for "dog brown".  
> > > > > I'm ideally looking for a solution which work with N words and put  
> > > > > weight accordingly the number of words.
> > > > > 
> > > > > Regards,  
> > > > > Jeremy
> > > > > 
> > > > > --  
> > > > > 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).
> > > > > 
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > .  
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit  
> > > > [https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, send an email to  
> > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC\_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC\_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > 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).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwSTADYKzJo0HsxrLhpTteDYMDT-dkFcDHB8GZSmJ3\_MA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwSTADYKzJo0HsxrLhpTteDYMDT-dkFcDHB8GZSmJ3_MA%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwSTADYKzJo0HsxrLhpTteDYMDT-dkFcDHB8GZSmJ3\_MA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwSTADYKzJo0HsxrLhpTteDYMDT-dkFcDHB8GZSmJ3_MA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5m%3D6T04KLCNCwKOy1bNiurZsFfNy4x-U%3DTKfd%2BebHmSsA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5m%3D6T04KLCNCwKOy1bNiurZsFfNy4x-U%3DTKfd%2BebHmSsA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Jeremy\_3](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jeremy\_3](https://discuss.elastic.co/u/Jeremy_3)\
**Post date:** [August 25, 2014, 7:33am UTC](https://discuss.elastic.co/t/boost-the-first-word-in-a-multi-word-query/19406/7 "2014-08-25T07:33:05Z")

</div>

Thank you so much for the warning, I was about to make that mistake 😉

On Mon, Aug 25, 2014 at 5:23 AM, vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com)  
wrote:

> Hello Jeremy ,
> 
> Just a word of caution.  
> Its not reccomonded to expose query\_string to end user.  
> Rather another version of it used instead -  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html)
> 
> Thanks  
> Vineeth
> 
> On Mon, Aug 25, 2014 at 12:57 AM, Jérémy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:
> 
> > Thanks Vineeth, I can certainly build something with the query string 🙂
> > 
> > On Fri, Aug 22, 2014 at 8:50 PM, vineeth mohan \<[vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com)
> > 
> > > wrote:
> > 
> > > Hello Jeremy ,
> > > 
> > > You can try query\_string then.
> > > 
> > > Query as "Brown^2 dog"
> > > 
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-dsl-query-string-query)
> > > 
> > > Thanks  
> > > Vineeth
> > > 
> > > On Sat, Aug 23, 2014 at 12:11 AM, Jérémy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:
> > > 
> > > > Thanks for your answer!
> > > > 
> > > > Unfortunately the phrase query is not enough, because I still want to  
> > > > keep words optional. In my understanding, the phrase query requires all the  
> > > > words of the query to be present.
> > > > 
> > > > Cheers,  
> > > > Jeremy
> > > > 
> > > > On Fri, Aug 22, 2014 at 8:20 PM, vineeth mohan \<  
> > > > [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com)\> wrote:
> > > > 
> > > > > Hello Jeremy ,
> > > > > 
> > > > > I feel what you are looking for is a phrase query . It takes into  
> > > > > consideration the order of words -  
> > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#_phrase)
> > > > > 
> > > > > Thanks  
> > > > > Vineeth
> > > > > 
> > > > > On Fri, Aug 22, 2014 at 3:28 PM, Jeremy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:
> > > > > 
> > > > > > In case of a multi-word query, is there a way to boost the first  
> > > > > > terms of the query?
> > > > > > 
> > > > > > For example, in the following query:  
> > > > > > GET /my\_index/my\_type/\_search  
> > > > > > {  
> > > > > > "query": {  
> > > > > > "match": {  
> > > > > > "title": "BROWN DOG!"  
> > > > > > }  
> > > > > > }  
> > > > > > }
> > > > > > 
> > > > > > "Brown" should be prioritized over "dog", therefore searching for  
> > > > > > "brown dog" will not return the same scores as searching for "dog brown".  
> > > > > > I'm ideally looking for a solution which work with N words and put  
> > > > > > weight accordingly the number of words.
> > > > > > 
> > > > > > Regards,  
> > > > > > Jeremy
> > > > > > 
> > > > > > --  
> > > > > > 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).
> > > > > > 
> > > > > > To view this discussion on the web visit  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com)  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > .  
> > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to a topic in the  
> > > > > Google Groups "elasticsearch" group.  
> > > > > To unsubscribe from this topic, visit  
> > > > > [https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe)  
> > > > > .  
> > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC\_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC\_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > .
> > > > > 
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > 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).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > 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).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwSTADYKzJo0HsxrLhpTteDYMDT-dkFcDHB8GZSmJ3\_MA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwSTADYKzJo0HsxrLhpTteDYMDT-dkFcDHB8GZSmJ3_MA%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwSTADYKzJo0HsxrLhpTteDYMDT-dkFcDHB8GZSmJ3\_MA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwSTADYKzJo0HsxrLhpTteDYMDT-dkFcDHB8GZSmJ3_MA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5m%3D6T04KLCNCwKOy1bNiurZsFfNy4x-U%3DTKfd%2BebHmSsA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5m%3D6T04KLCNCwKOy1bNiurZsFfNy4x-U%3DTKfd%2BebHmSsA%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5m%3D6T04KLCNCwKOy1bNiurZsFfNy4x-U%3DTKfd%2BebHmSsA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5m%3D6T04KLCNCwKOy1bNiurZsFfNy4x-U%3DTKfd%2BebHmSsA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEyCC6YMUyx\_o8nRLDhmaRfFH%3DcvK5\_wQG874CpcaGHgpA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEyCC6YMUyx_o8nRLDhmaRfFH%3DcvK5_wQG874CpcaGHgpA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Jeremy\_3](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jeremy\_3](https://discuss.elastic.co/u/Jeremy_3)\
**Post date:** [August 25, 2014, 8:55am UTC](https://discuss.elastic.co/t/boost-the-first-word-in-a-multi-word-query/19406/8 "2014-08-25T08:55:51Z")

</div>

Hum I didn't notice the change of behavior of the + sign. I prefer the how  
"query string" handle that.

Is there a way to have a "must be present" operator for "simple string  
query"?

Cheers,  
Jeremy

On Mon, Aug 25, 2014 at 9:33 AM, Jérémy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:

> Thank you so much for the warning, I was about to make that mistake 😉
> 
> On Mon, Aug 25, 2014 at 5:23 AM, vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com)  
> wrote:
> 
> > Hello Jeremy ,
> > 
> > Just a word of caution.  
> > Its not reccomonded to expose query\_string to end user.  
> > Rather another version of it used instead -  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html)
> > 
> > Thanks  
> > Vineeth
> > 
> > On Mon, Aug 25, 2014 at 12:57 AM, Jérémy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:
> > 
> > > Thanks Vineeth, I can certainly build something with the query string 🙂
> > > 
> > > On Fri, Aug 22, 2014 at 8:50 PM, vineeth mohan \<  
> > > [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com)\> wrote:
> > > 
> > > > Hello Jeremy ,
> > > > 
> > > > You can try query\_string then.
> > > > 
> > > > Query as "Brown^2 dog"
> > > > 
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-dsl-query-string-query)
> > > > 
> > > > Thanks  
> > > > Vineeth
> > > > 
> > > > On Sat, Aug 23, 2014 at 12:11 AM, Jérémy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:
> > > > 
> > > > > Thanks for your answer!
> > > > > 
> > > > > Unfortunately the phrase query is not enough, because I still want to  
> > > > > keep words optional. In my understanding, the phrase query requires all the  
> > > > > words of the query to be present.
> > > > > 
> > > > > Cheers,  
> > > > > Jeremy
> > > > > 
> > > > > On Fri, Aug 22, 2014 at 8:20 PM, vineeth mohan \<  
> > > > > [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com)\> wrote:
> > > > > 
> > > > > > Hello Jeremy ,
> > > > > > 
> > > > > > I feel what you are looking for is a phrase query . It takes into  
> > > > > > consideration the order of words -  
> > > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#_phrase)
> > > > > > 
> > > > > > Thanks  
> > > > > > Vineeth
> > > > > > 
> > > > > > On Fri, Aug 22, 2014 at 3:28 PM, Jeremy [merejy@gmail.com](mailto:merejy@gmail.com) wrote:
> > > > > > 
> > > > > > > In case of a multi-word query, is there a way to boost the first  
> > > > > > > terms of the query?
> > > > > > > 
> > > > > > > For example, in the following query:  
> > > > > > > GET /my\_index/my\_type/\_search  
> > > > > > > {  
> > > > > > > "query": {  
> > > > > > > "match": {  
> > > > > > > "title": "BROWN DOG!"  
> > > > > > > }  
> > > > > > > }  
> > > > > > > }
> > > > > > > 
> > > > > > > "Brown" should be prioritized over "dog", therefore searching for  
> > > > > > > "brown dog" will not return the same scores as searching for "dog brown".  
> > > > > > > I'm ideally looking for a solution which work with N words and put  
> > > > > > > weight accordingly the number of words.
> > > > > > > 
> > > > > > > Regards,  
> > > > > > > Jeremy
> > > > > > > 
> > > > > > > --  
> > > > > > > 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).
> > > > > > > 
> > > > > > > To view this discussion on the web visit  
> > > > > > > [https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com)  
> > > > > > > [https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a53f5752-3da0-41de-b970-f84573b8f5a3%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > > .  
> > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to a topic in  
> > > > > > the Google Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this topic, visit  
> > > > > > [https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe)  
> > > > > > .  
> > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > To view this discussion on the web visit  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC\_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com)  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC\_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D51EiC_SmiDXD0k2Yj0YacnvXVzaqUOshdkD81HFpgsA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > > .
> > > > > > 
> > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > 
> > > > > --  
> > > > > 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).  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwjxRwLgfHAmNWxoGa0BX5ZSEtk6J0QFBvWCBcW8wX42Q%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > .
> > > > > 
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit  
> > > > [https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, send an email to  
> > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k5M8vasScWqjx%2BwHUD%2B-EGof2cLGJGH3YueMKpW0hYFQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > 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).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwSTADYKzJo0HsxrLhpTteDYMDT-dkFcDHB8GZSmJ3\_MA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwSTADYKzJo0HsxrLhpTteDYMDT-dkFcDHB8GZSmJ3_MA%40mail.gmail.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwSTADYKzJo0HsxrLhpTteDYMDT-dkFcDHB8GZSmJ3\_MA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGNSLEwSTADYKzJo0HsxrLhpTteDYMDT-dkFcDHB8GZSmJ3_MA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ojEtydA4zAw/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5m%3D6T04KLCNCwKOy1bNiurZsFfNy4x-U%3DTKfd%2BebHmSsA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5m%3D6T04KLCNCwKOy1bNiurZsFfNy4x-U%3DTKfd%2BebHmSsA%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5m%3D6T04KLCNCwKOy1bNiurZsFfNy4x-U%3DTKfd%2BebHmSsA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5m%3D6T04KLCNCwKOy1bNiurZsFfNy4x-U%3DTKfd%2BebHmSsA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGNSLExep7RDde5KpDdv3emm3xs2p9%2B3QDtfxRE9agZM%2Boi1Ng%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGNSLExep7RDde5KpDdv3emm3xs2p9%2B3QDtfxRE9agZM%2Boi1Ng%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:06am UTC](https://discuss.elastic.co/t/boost-the-first-word-in-a-multi-word-query/19406/9 "2017-07-06T01:06:44Z")

</div>


