# Visualization filter DSL query

**URL:** <https://discuss.elastic.co/t/visualization-filter-dsl-query/246210>\
**Category:** Kibana\
**Created:** [August 25, 2020, 3:23am UTC](https://discuss.elastic.co/t/visualization-filter-dsl-query/246210 "2020-08-25T03:23:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Incauto](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/incauto/32/60149_2.png) [@Incauto](https://discuss.elastic.co/u/Incauto)\
**Post date:** [August 25, 2020, 3:23am UTC](https://discuss.elastic.co/t/visualization-filter-dsl-query/246210/1 "2020-08-25T03:23:27Z")

</div>

Hi, in an index I have fields for interface and host, a host has many interfaces:

```auto
HOST-01 : interface01, interface02
HOST-02 : interface01, interface02
             

```

and I want to filter a specific interface for a especific host for example: interface01 from HOST-01 and interface02 for HOST-02

How can I do this with a DSL query?

I know how to filter by host, but I cant figure out how to filter a specific interface for a especific host.

```auto
{
  "query": {
    "bool": {
      "must": {
        "terms": {
          "node_name.keyword": [
            "HOST-01"
            "HOST-02"
          ]
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![Marta\_Bondyra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marta_bondyra/32/102122_2.png) [@Marta\_Bondyra](https://discuss.elastic.co/u/Marta_Bondyra)\
**Post date:** [August 27, 2020, 11:36am UTC](https://discuss.elastic.co/t/visualization-filter-dsl-query/246210/2 "2020-08-27T11:36:46Z")

</div>

Hi @Incauto,

I've created this example with kibana\_sample\_data\_ecommerce that I think is close to what you're looking for:  
We're filtering for men's clothing on friday OR women's clothing on Monday. Take a look and let me know if that's helpful

```auto
GET /kibana_sample_data_ecommerce/_search
{
  "size": 0,
  "aggs": {
    "agg_name": {
      "filters": {
        "filters": {
          "men and friday": {
            "bool": {
              "filter": [
                {
                  "bool": {
                    "should": [
                      {
                        "match_phrase": {
                          "category.keyword": "Men's Clothing"
                        }
                      }
                    ],
                    "minimum_should_match": 1
                  }
                },
                {
                  "bool": {
                    "should": [
                      {
                        "match_phrase": {
                          "day_of_week": "Friday"
                        }
                      }
                    ],
                    "minimum_should_match": 1
                  }
                }
              ]
            }
          },
          "women and monday": {
            "bool": {
              "filter": [
                {
                  "bool": {
                    "should": [
                      {
                        "match_phrase": {
                          "category.keyword": "Women's Clothing"
                        }
                      }
                    ],
                    "minimum_should_match": 1
                  }
                },
                {
                  "bool": {
                    "should": [
                      {
                        "match_phrase": {
                          "day_of_week": "Monday"
                        }
                      }
                    ],
                    "minimum_should_match": 1
                  }
                }
              ]
            }
          }
        }
      }
    }
  }
}

```

---

<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:** [September 24, 2020, 11:36am UTC](https://discuss.elastic.co/t/visualization-filter-dsl-query/246210/3 "2020-09-24T11:36:57Z")

</div>

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