Limiting Response Data Using URI Based on Value of Search Term

I'm looking to filter out data in response objects based on the value of a search term. The request below for instance, filters the data within the objects themselves, excluding a particular field (attribute.betaalmethode):

GET transactions/_search?filter_path=_scroll_id,hits.hits._source,-hits.hits._source.attributes.betaalmethode&scroll=1m&size=100
{
  "query": {
    "bool": {
      "filter": [
        {"term": {"elastic_tag_subdomain": "utilizetestdev"}},
        {"term": {"elastic_tag_module": "order"}}
      ]
    }
  }
}

However, I want to filter based on a value of betaalmethode.

My response for this field looks like this (inside the attribute object):

"betaalmethode": [ "PayPal" ]

I would like to exclude betaalmethode in the response objects when the value is ["PayPal"]. I saw some docs here:

But I'm not too sure how I could apply any of it. It seems that it would be pretty straightforward if the filter is on the object property, but I can't seem to figure out how to do it on the value of the object property.

Any help would be greatly appreciated :slight_smile:

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