# Are there any performance impact of using source filtering in elasticsearch or spring data elasticsearch?

**URL:** <https://discuss.elastic.co/t/are-there-any-performance-impact-of-using-source-filtering-in-elasticsearch-or-spring-data-elasticsearch/240671>\
**Category:** Elasticsearch\
**Created:** [July 10, 2020, 9:55am UTC](https://discuss.elastic.co/t/are-there-any-performance-impact-of-using-source-filtering-in-elasticsearch-or-spring-data-elasticsearch/240671 "2020-07-10T09:55:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohsin](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@mohsin](https://discuss.elastic.co/u/mohsin)\
**Post date:** [July 10, 2020, 9:55am UTC](https://discuss.elastic.co/t/are-there-any-performance-impact-of-using-source-filtering-in-elasticsearch-or-spring-data-elasticsearch/240671/1 "2020-07-10T09:55:25Z")

</div>

We have documents in the range 50k-100k. We are using the `ElasticsearchOperations` interface of spring-data-elasticsearch and using `NativeSearchQueryBuilder()`s `withSourceFilter(new FetchSourceFilter(includeFields, excludeFields))`method to return only required fields. We wanted to know whether this source filtering have any performance impact? even if we are using simple elasticsearch query which returns all the records but having source filtering, will performance be affected? Or is it better to return all the fields? we have chosen to not to return all the fields as some of the fields can be larger in size i.e some of the fields can be list/array containing thousands of items.

---

<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:** [August 7, 2020, 9:55am UTC](https://discuss.elastic.co/t/are-there-any-performance-impact-of-using-source-filtering-in-elasticsearch-or-spring-data-elasticsearch/240671/2 "2020-08-07T09:55:26Z")

</div>

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