Granted documents query

Hello!
How can I specify in a granted documents query that I want show only the documents that match with a service.name AND service.environment?
I tried with the following query but I also saw other service.environment different from the one I indicated (staging):

{
  "bool": {
    "must": [ // (I also tried with "filter")
      {
        "match": {
          "service.name":"myWeb"
        }
      },
      {
        "match": {
          "service.environment":"staging"
        }
      }
    ]
  }
}

Thank you !

Hi @mar-ro

Perhaps take a look at this similar post here

In short I suspect you should be using a term query with fields that are of type keyword.

The example in the post about uses an API key but the concept is the same.

And using a filter is good approach as well.

Ok, thank you @stephenb !
I'll take a look it !

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