# Match query with suggestion search

**URL:** <https://discuss.elastic.co/t/match-query-with-suggestion-search/113706>\
**Category:** Elasticsearch\
**Created:** [January 1, 2018, 7:09pm UTC](https://discuss.elastic.co/t/match-query-with-suggestion-search/113706 "2018-01-01T19:09:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankur\_singla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ankur_singla/32/45612_2.png) [@ankur\_singla](https://discuss.elastic.co/u/ankur_singla)\
**Post date:** [January 1, 2018, 7:09pm UTC](https://discuss.elastic.co/t/match-query-with-suggestion-search/113706/1 "2018-01-01T19:09:40Z")

</div>

I have created a mapping of index **searchable** :

```
PUT searchable
{
    "mappings": {
        "searchCol" : {
            "properties" : {
                "suggest" : {
                    "type" : "completion"
                },
                "title" : {
                    "type": "keyword"
                }
            }
        }
    }
}

```

with some documents title wise:

```
PUT music/song/2?refresh
{
    "suggest" : ["val", "value", "val of", "value of"],
    "title" : "a"
}

```

I want to search suggestion only in particular titled documents such that in **title:a** documents. But match is not working with suggest.

```
POST music/_search?pretty&size=1
{
  "query" : {"match":{"title": "a"}},
    "suggest": {
        "suggestion" : {
            "prefix" : "val", 
            "completion" : { 
                "field" : "suggest"
            }
        }
    }
}

```

Still searching in all documents. Is there any way to do it?

---

<div class="post-metadata">

**Author:** ![luiz.santos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luiz.santos/32/24664_2.png) [@luiz.santos](https://discuss.elastic.co/u/luiz.santos)\
**Post date:** [January 2, 2018, 7:32pm UTC](https://discuss.elastic.co/t/match-query-with-suggestion-search/113706/2 "2018-01-02T19:32:34Z")

</div>

Hi @ankur_singla,

The completion suggester is not filtered by the query, it considers all documents in the index. Please take a look in [Context Suggester](https://www.elastic.co/guide/en/elasticsearch/reference/current/suggester-context.html) it might do the job you are looking for.

Cheers,  
LG

---

<div class="post-metadata">

**Author:** ![ankur\_singla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ankur_singla/32/45612_2.png) [@ankur\_singla](https://discuss.elastic.co/u/ankur_singla)\
**Post date:** [January 8, 2018, 3:10am UTC](https://discuss.elastic.co/t/match-query-with-suggestion-search/113706/3 "2018-01-08T03:10:43Z")

</div>

> [@luiz.santos](#):
>
> query

thanxs.

---

<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:** [February 5, 2018, 3:10am UTC](https://discuss.elastic.co/t/match-query-with-suggestion-search/113706/4 "2018-02-05T03:10:51Z")

</div>

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