Filter based on String variable using Script Query


I wish to set up a filter in my dashboard using painless script. I wish to do a query for a field ,named 'message', for the text 'foo' , in turn, run a script to get text from another field called activity_id, assign it to a string variable and then filter based on value in the string variable. I've tried googling this matter and was unable to find a solution. Code is below that might show easier what I'm trying to achieve.

        {"match":{"message": "foo"}}
          "filter": {
              "script": {
                "script": {
                  "source": "String tester = doc['activity_id.keyword'].value"
      },"should": [
        {"match": {
            "query": "tester"

(system) #2

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