How to filter a list of word with kibana

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

{
  "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?

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

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)

1 Like

Thanks for your answer, I'll try it.

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.

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

the message I got in kibana looks like that:

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

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

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

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

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


even like that does not work :confused:

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