# Limiting Response Data Using URI Based on Value of Search Term

**URL:** <https://discuss.elastic.co/t/limiting-response-data-using-uri-based-on-value-of-search-term/336507>\
**Category:** Elasticsearch\
**Created:** [June 20, 2023, 7:51pm UTC](https://discuss.elastic.co/t/limiting-response-data-using-uri-based-on-value-of-search-term/336507 "2023-06-20T19:51:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akaash\_Mukherjee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akaash_mukherjee/32/119513_2.png) [@Akaash\_Mukherjee](https://discuss.elastic.co/u/Akaash_Mukherjee)\
**Post date:** [June 20, 2023, 7:51pm UTC](https://discuss.elastic.co/t/limiting-response-data-using-uri-based-on-value-of-search-term/336507/1 "2023-06-20T19:51:14Z")

</div>

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):

```auto
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:

> **[Common options | Elasticsearch Guide \[8.8\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#common-options-response-filtering)**

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 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 18, 2023, 7:51pm UTC](https://discuss.elastic.co/t/limiting-response-data-using-uri-based-on-value-of-search-term/336507/2 "2023-07-18T19:51:30Z")

</div>

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