# Filtered index alias not working

**URL:** <https://discuss.elastic.co/t/filtered-index-alias-not-working/116244>\
**Category:** Elasticsearch\
**Created:** [January 19, 2018, 1:28pm UTC](https://discuss.elastic.co/t/filtered-index-alias-not-working/116244 "2018-01-19T13:28:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mheck](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@mheck](https://discuss.elastic.co/u/mheck)\
**Post date:** [January 19, 2018, 1:28pm UTC](https://discuss.elastic.co/t/filtered-index-alias-not-working/116244/1 "2018-01-19T13:28:33Z")

</div>

I want to use an Index alias with a filter to have an index which only contains documents with a certain property set to a specific value.

I added the following filter:

```
{
  "filebeat-2018.01": {
    "aliases": {
      "filebeat-GTVMA480-2018.01": {
        "filter": {
          "term": {
            "host": "GTVMA480"
          }
        }
      }
    }
  }
}

```

So I want all documents with host:GTVMA480.

When I search in Kibana for host:GTVMA480 in index filebeat-2018.01, i can find the documents, but when I search in the alias index, i don't get any documents.

Here is an excerpt of my mappings:

```
"host": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          }

```

I'm on ES 6.0.0

What do I need to change?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 19, 2018, 3:17pm UTC](https://discuss.elastic.co/t/filtered-index-alias-not-working/116244/2 "2018-01-19T15:17:07Z")

</div>

Great job, you're on the right track! You simply need to use the `keyword` sub-field in your alias filter, like this and it'll work like a charm:

```
{
  "filebeat-2018.01": {
    "aliases": {
      "filebeat-GTVMA480-2018.01": {
        "filter": {
          "term": {
            "host.keyword": "GTVMA480" <-- use the keyword field here
          }
        }
      }
    }
  }
}
```

---

<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 16, 2018, 3:17pm UTC](https://discuss.elastic.co/t/filtered-index-alias-not-working/116244/3 "2018-02-16T15:17:07Z")

</div>

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