# How to expand query\_string

**URL:** <https://discuss.elastic.co/t/how-to-expand-query-string/69204>\
**Category:** Elasticsearch\
**Created:** [December 15, 2016, 5:54pm UTC](https://discuss.elastic.co/t/how-to-expand-query-string/69204 "2016-12-15T17:54:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fabien\_Sarlat](https://avatars.discourse-cdn.com/v4/letter/f/7ab992/32.png) [@Fabien\_Sarlat](https://discuss.elastic.co/u/Fabien_Sarlat)\
**Post date:** [December 15, 2016, 5:54pm UTC](https://discuss.elastic.co/t/how-to-expand-query-string/69204/1 "2016-12-15T17:54:20Z")

</div>

Hello !

i want to expand query for more revelance.

For exemple, i want to perform this query "aa AND bb AND cc" on multiple fields, but i want to boost the revelance of one field -\> title

i want to do something like this :

```
'query' => [
    'query_string' => [
        'fields' => [
            'title',
            'field1',
            'field2',
            'field3',
            'field4',
            'field5',
        ],
        'query' => 'title:(aa AND bb AND cc)^5 OR
            (title:(aa AND bb)^3 OR cc) OR 
            (title:(aa AND cc)^3 OR bb) OR 
            (title:(bb AND cc)^3 OR aa) '

```

This way, my doc with a title containing "aa" and "bb" and "cc" will be on top, then the doc with only 2 of them will follow.

I want to know if there a way to acheive this with Es without to do it manually.

Thanks !!

---

<div class="post-metadata">

**Author:** ![mikemccand](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mikemccand](https://discuss.elastic.co/u/mikemccand)\
**Post date:** [December 16, 2016, 8:00pm UTC](https://discuss.elastic.co/t/how-to-expand-query-string/69204/2 "2016-12-16T20:00:21Z")

</div>

I suggest reading this chapter: [https://www.elastic.co/guide/en/elasticsearch/guide/current/multi-field-search.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/multi-field-search.html)

Likely a `multi_match` query, boosting your `title` field, would work?

Mike McCandless

---

<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:** [January 13, 2017, 8:00pm UTC](https://discuss.elastic.co/t/how-to-expand-query-string/69204/3 "2017-01-13T20:00:46Z")

</div>

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