# How to filter a list of word with kibana

**URL:** <https://discuss.elastic.co/t/how-to-filter-a-list-of-word-with-kibana/255515>\
**Category:** Kibana\
**Created:** [November 16, 2020, 11:48am UTC](https://discuss.elastic.co/t/how-to-filter-a-list-of-word-with-kibana/255515 "2020-11-16T11:48:18Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![slim-hmidi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/slim-hmidi/32/79058_2.png) [@slim-hmidi](https://discuss.elastic.co/u/slim-hmidi)\
**Post date:** [November 16, 2020, 11:48am UTC](https://discuss.elastic.co/t/how-to-filter-a-list-of-word-with-kibana/255515/1 "2020-11-16T11:48:18Z")

</div>

I tried to fetch some word using regexp in the filter but does not work:

```auto
{
  "query": {
    "regexp": {
      "message": {
      "value": "*.word1.word2.word3.*"
      }
    }
  }
}

```

I want to fetch messages that contains this bloc "word1.word2.word3". I don't know if I wrote something wrong or kibana does not accept this format.  
How can I fix it?

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [November 16, 2020, 12:21pm UTC](https://discuss.elastic.co/t/how-to-filter-a-list-of-word-with-kibana/255515/2 "2020-11-16T12:21:23Z")

</div>

If you want to find documents containing a certain substring, the wildcard query is probably the best choice: [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html)

Just switch `regexp` with `wildcard` and you should be good to go. However it will match everything containing `.word1.word2.word3.` (note the leading and trailing dots)

---

<div class="post-metadata">

**Author:** ![slim-hmidi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/slim-hmidi/32/79058_2.png) [@slim-hmidi](https://discuss.elastic.co/u/slim-hmidi)\
**Post date:** [November 16, 2020, 1:16pm UTC](https://discuss.elastic.co/t/how-to-filter-a-list-of-word-with-kibana/255515/3 "2020-11-16T13:16:03Z")

</div>

Thanks for your answer, I'll try it.

---

<div class="post-metadata">

**Author:** ![slim-hmidi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/slim-hmidi/32/79058_2.png) [@slim-hmidi](https://discuss.elastic.co/u/slim-hmidi)\
**Post date:** [November 16, 2020, 1:32pm UTC](https://discuss.elastic.co/t/how-to-filter-a-list-of-word-with-kibana/255515/4 "2020-11-16T13:32:57Z")

</div>

I tried it but does not work, I have to mention the whole phrase to get the result, otherwise it is not able to filter the lines where the message contains the block of words I use to filter.

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [November 16, 2020, 3:44pm UTC](https://discuss.elastic.co/t/how-to-filter-a-list-of-word-with-kibana/255515/5 "2020-11-16T15:44:40Z")

</div>

Can you share the mapping of your index and the filter you are testing with right now?

---

<div class="post-metadata">

**Author:** ![slim-hmidi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/slim-hmidi/32/79058_2.png) [@slim-hmidi](https://discuss.elastic.co/u/slim-hmidi)\
**Post date:** [November 16, 2020, 4:00pm UTC](https://discuss.elastic.co/t/how-to-filter-a-list-of-word-with-kibana/255515/7 "2020-11-16T16:00:27Z")

</div>

the message I got in kibana looks like that:

 ![kibana](https://us1.discourse-cdn.com/elastic/original/3X/a/4/a4b61ec5fbbf5aa4aa694525a6534e5587697749.png)

and I'm lookig for messages containing "PSEGP.PSETP"

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [November 17, 2020, 7:37am UTC](https://discuss.elastic.co/t/how-to-filter-a-list-of-word-with-kibana/255515/8 "2020-11-17T07:37:52Z")

</div>

Can you please copy-paste the filter JSON you are using which should work but doesn't?

---

<div class="post-metadata">

**Author:** ![slim-hmidi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/slim-hmidi/32/79058_2.png) [@slim-hmidi](https://discuss.elastic.co/u/slim-hmidi)\
**Post date:** [November 17, 2020, 10:12am UTC](https://discuss.elastic.co/t/how-to-filter-a-list-of-word-with-kibana/255515/9 "2020-11-17T10:12:25Z")

</div>

```
{
  "query": {
    "wildcard": {
      "message": {
        "value": "*.PSEGP.PSETP.*"
      }
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [November 17, 2020, 10:15am UTC](https://discuss.elastic.co/t/how-to-filter-a-list-of-word-with-kibana/255515/10 "2020-11-17T10:15:37Z")

</div>

There is no `.` in front of "PSEGP" in your example - try

```auto
{
  "query": {
    "wildcard": {
      "message": {
        "value": "*PSEGP.PSETP.*"
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![slim-hmidi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/slim-hmidi/32/79058_2.png) [@slim-hmidi](https://discuss.elastic.co/u/slim-hmidi)\
**Post date:** [November 17, 2020, 10:32am UTC](https://discuss.elastic.co/t/how-to-filter-a-list-of-word-with-kibana/255515/12 "2020-11-17T10:32:23Z")

</div>

even like that does not work 😕

---

<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:** [December 15, 2020, 10:32am UTC](https://discuss.elastic.co/t/how-to-filter-a-list-of-word-with-kibana/255515/13 "2020-12-15T10:32:28Z")

</div>

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