2

I am searching for records which contain an array field payload.params

I would like to display all the fields which contain the string aabb

example: payload.params = [3raabb, 44aabb66, grgeg] display: 3raabb, 44aabb66

how do I use regex on arrays?

{
  "query": {
    "regexp": {
      "payload.params": "aabb"
    }
  }
}

get no results.

0

1 Answer 1

2

See the Elasticsearch regex documentation:

Lucene’s patterns are always anchored. The pattern provided must match the entire string.

Thus, use

{
  "query": {
    "regexp": {
      "payload.params": ".*aabb.*"
    }
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.