# Suggester filter by certain condition

**URL:** <https://discuss.elastic.co/t/suggester-filter-by-certain-condition/189647>\
**Category:** Elasticsearch\
**Created:** [July 10, 2019, 2:40am UTC](https://discuss.elastic.co/t/suggester-filter-by-certain-condition/189647 "2019-07-10T02:40:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jslim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jslim/32/49746_2.png) [@jslim](https://discuss.elastic.co/u/jslim)\
**Post date:** [July 10, 2019, 2:40am UTC](https://discuss.elastic.co/t/suggester-filter-by-certain-condition/189647/1 "2019-07-10T02:40:01Z")

</div>

Example, I have this data

| id | title | subtitle | country\_id |
| --- | --- | --- | --- |
| 1 | Cheapest iPhone in town | Lorem ipsum | 123 |
| 2 | iOS 13 beta released | Lorem ipsum | 25 |
| 3 | iPadOS public beta | Lorem ipsum | 123 |

I want to get the suggestion from **country** `123`

**POST \_search**

```
{
  "suggest": {
    "text": "iphame",
    "0-title": {
      "phrase": {
        "field": "title"
        }
      }
    },
    "1-subtitle": {
      "phrase": {
        "field": "subtitle"
      }
    }
  }
}

```

The query above will get the suggestion from all 3 rows. How can I only take **country\_id** `123` ?

---

<div class="post-metadata">

**Author:** ![varunnatraaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varunnatraaj/32/23113_2.png) [@varunnatraaj](https://discuss.elastic.co/u/varunnatraaj)\
**Post date:** [July 11, 2019, 1:15pm UTC](https://discuss.elastic.co/t/suggester-filter-by-certain-condition/189647/2 "2019-07-11T13:15:48Z")

</div>

I've a need for this usecase as well 🙂 Would be nice to know if this is possible.

Can someone help here please?

---

<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:** [August 8, 2019, 1:25pm UTC](https://discuss.elastic.co/t/suggester-filter-by-certain-condition/189647/3 "2019-08-08T13:25:33Z")

</div>

Closed on August 8, 2019, 1:25pm UTC

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