# Text query with multi fields

**URL:** <https://discuss.elastic.co/t/text-query-with-multi-fields/6203>\
**Category:** Elasticsearch\
**Created:** [December 21, 2011, 1:25am UTC](https://discuss.elastic.co/t/text-query-with-multi-fields/6203 "2011-12-21T01:25:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ciryus](https://avatars.discourse-cdn.com/v4/letter/c/aeb1de/32.png) [@Ciryus](https://discuss.elastic.co/u/Ciryus)\
**Post date:** [December 21, 2011, 1:25am UTC](https://discuss.elastic.co/t/text-query-with-multi-fields/6203/1 "2011-12-21T01:25:04Z")

</div>

Hi,

I am trying to create a text query, but I want the "multi field" part of  
the query string. i.e. I want :

{  
"query\_string" : {  
"fields" : ["content", "name^5"],  
"query" : "foo bar baz",  
}  
}

But using the "text" query instead of "query\_string", because query\_string  
chokes on simple stuff (like searching for $('#bar')). I still want to keep  
the multiple fields, and give them different boost at query time. Any idea  
on how to do that?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [December 21, 2011, 3:47am UTC](https://discuss.elastic.co/t/text-query-with-multi-fields/6203/2 "2011-12-21T03:47:00Z")

</div>

You can wrap several text queries either with dismax or with bool query.

On Wed, Dec 21, 2011 at 3:25 AM, Ciryus [ciryus432@gmail.com](mailto:ciryus432@gmail.com) wrote:

> Hi,
> 
> I am trying to create a text query, but I want the "multi field" part of  
> the query string. i.e. I want :
> 
> {
> 
> ```
> "query_string" : {
> 
> "fields" : ["content", "name^5"],
> 
> "query" : "foo bar baz",
> }
> 
> ```
> 
> }
> 
> But using the "text" query instead of "query\_string", because query\_string  
> chokes on simple stuff (like searching for $('#bar')). I still want to keep  
> the multiple fields, and give them different boost at query time. Any idea  
> on how to do that?

---

<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:44am UTC](https://discuss.elastic.co/t/text-query-with-multi-fields/6203/3 "2017-07-06T03:44:48Z")

</div>


