# Pinned Filters Not Working In Visualizations

**URL:** <https://discuss.elastic.co/t/pinned-filters-not-working-in-visualizations/100477>\
**Category:** Kibana\
**Created:** [September 14, 2017, 7:46am UTC](https://discuss.elastic.co/t/pinned-filters-not-working-in-visualizations/100477 "2017-09-14T07:46:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vincentpaca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vincentpaca/32/22096_2.png) [@vincentpaca](https://discuss.elastic.co/u/vincentpaca)\
**Post date:** [September 14, 2017, 7:46am UTC](https://discuss.elastic.co/t/pinned-filters-not-working-in-visualizations/100477/1 "2017-09-14T07:46:45Z")

</div>

I created a filter and pinned it but it's not taking effect in my visualization.

My filter looks like this:

```
{
  "query": {
    "bool": {
      "should": [
        {
          "exists": {
            "field": "field1"
          }
        },
        {
          "exists": {
            "field": "field2"
          }
        }
      ]
    }
  }
}

```

It works in my Discover tab but when I head over and use the same filter for my visualization, it's not working anymore.

I also tried doing it as a saved search and linking that to a visualization but it also doesn't work.

Am I missing something here?

I would appreciate any advice.

Edit: I'm running version 5.3.2

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [September 14, 2017, 5:19pm UTC](https://discuss.elastic.co/t/pinned-filters-not-working-in-visualizations/100477/2 "2017-09-14T17:19:06Z")

</div>

Is the pinned filter getting applied to the visualization? In the lower left corner of the visualization, click the `toggle spy panel` button. Look at the request for the visualization. Do you see your filter in the request?

---

<div class="post-metadata">

**Author:** ![vincentpaca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vincentpaca/32/22096_2.png) [@vincentpaca](https://discuss.elastic.co/u/vincentpaca)\
**Post date:** [September 15, 2017, 9:57am UTC](https://discuss.elastic.co/t/pinned-filters-not-working-in-visualizations/100477/3 "2017-09-15T09:57:35Z")

</div>

I think I get it now why it's not working and thank you for letting me know about the spy panel button, it led me to the right direction.

In my old filter, the request looked like this:

```
{
  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "analyze_wildcard": true,
            "query": "*"
          }
        },
        {
          "bool": {
            "should": [
              {
                "exists": {
                  "field": "field1"
                }
              },
              {
                "exists": {
                  "field": "field2"
                }
              }
            ]
          }
        },
        ...
        ...

```

So it made another level of `bool` inside the `bool` hash.

What I did instead was created two separate filters:

```
{
  "exists": {
    "field": "field1"
  }
}

```

and

```
{
  "exists": {
    "field": "field2"
  }
}

```

pinned them and they work in my visualization. The request also looks correct now:

```
{
  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "analyze_wildcard": true,
            "query": "*"
          }
        },
        {
          "$state": {
            "store": "globalState"
          },
          "exists": {
            "field": "field1"
          }
        },
        {
          "$state": {
            "store": "globalState"
          },
          "exists": {
            "field": "field2"
          }
        },
        ...
        ...

```

So it was a bit weird because the old filter works on discover but I guess it just works differently when applied to a visualization.

Thank you, Nathan!

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [September 15, 2017, 11:57am UTC](https://discuss.elastic.co/t/pinned-filters-not-working-in-visualizations/100477/4 "2017-09-15T11:57:05Z")

</div>

Glad to hear that you got everything to work.

The `spy panel` is my favorite part of kibana. It strips away all of the magic and lets you see whats really going on ... that kibana is just a slick GUI layer and all of the power comes from Elasticsearch's amazing REST API.

---

<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:** [October 13, 2017, 11:57am UTC](https://discuss.elastic.co/t/pinned-filters-not-working-in-visualizations/100477/5 "2017-10-13T11:57:14Z")

</div>

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