0

I'm using Kibana Stored Scripts and Search Templates to fetch data.

I have a request to power the Stored Script using a boolean sent through the Search Template.

Requirement

My ask is:

  • Use a parameter includeABC to fetch all docs which have ABC.
  • Default value of includeABC would be false

Current Code

The query part of my stored script is defined as follows:

{
  "bool": {
    "should": [
      {
        "query_string": {
          "query": "{{includeABC}}{{^includeABC}}FALSE{{/includeABC}} && name:ABC"
        }
      },
      {
        "query_string": {
          "query": "NOT {{includeABC}}{{^includeABC}}FALSE{{/includeABC}} && name:*"
        }
      }
    ]
  }
}

Review

This doesn't seem to work. How do you think I can use it?

0 Answers0