# Filter match using a query

**URL:** <https://discuss.elastic.co/t/filter-match-using-a-query/183403>\
**Category:** Elasticsearch\
**Created:** [May 29, 2019, 6:32pm UTC](https://discuss.elastic.co/t/filter-match-using-a-query/183403 "2019-05-29T18:32:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Yeung](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul_yeung/32/47106_2.png) [@Paul\_Yeung](https://discuss.elastic.co/u/Paul_Yeung)\
**Post date:** [May 29, 2019, 6:32pm UTC](https://discuss.elastic.co/t/filter-match-using-a-query/183403/1 "2019-05-29T18:32:12Z")

</div>

Hi there,

I have the below query on a filter. There is also another query in the filter to makes up the filter. But it doesn't work at all. I mean the filter is not able use the names from "school" to filter on "male" table.

```
{
  "query": """
            SELECT 
            name
            FROM male
            
""",
  "filter": {
    "match": {
      "name": {
        "query": """
            SELECT 
            name
            FROM school
            
"""
      }
    }
  },
  "fetch_size": 50
}
```

---

<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:** [June 26, 2019, 6:32pm UTC](https://discuss.elastic.co/t/filter-match-using-a-query/183403/2 "2019-06-26T18:32:12Z")

</div>

Closed on June 26, 2019, 6:32pm UTC

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