# \_search request. Get only objects / elements inside hits?

**URL:** <https://discuss.elastic.co/t/search-request-get-only-objects-elements-inside-hits/196456>\
**Category:** Elasticsearch\
**Created:** [August 23, 2019, 6:57am UTC](https://discuss.elastic.co/t/search-request-get-only-objects-elements-inside-hits/196456 "2019-08-23T06:57:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![asp](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@asp](https://discuss.elastic.co/u/asp)\
**Post date:** [August 23, 2019, 6:57am UTC](https://discuss.elastic.co/t/search-request-get-only-objects-elements-inside-hits/196456/1 "2019-08-23T06:57:49Z")

</div>

Hi,

I want to query elasticsearch for exporting a subset of data to be able to import it into a separate elasticsearch instance, which is not connected. Also I need to export as plain text, that the exporter is able to double check data and to render personal data anonymous manually.

The output response for the \_search looks like the following:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/c/fc33de9b98c463e699e9990fe7caf08aadfe57f2.png)

I want only to have the objects inside **hits**. I assume that I can just feed these objects to logstash for importing into the other instance.

Is there any option that elasticsearch is just delivering these array elements, or do I need to post process the results to only return the hits' entries?

Thanks, Andreas

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 23, 2019, 7:07am UTC](https://discuss.elastic.co/t/search-request-get-only-objects-elements-inside-hits/196456/2 "2019-08-23T07:07:31Z")

</div>

Postprocessing is the way to go here, you can use `filter_path` to only return the `hits.hits` data structure, but you cannot change the structure and move fields around within Elasticsearch.

---

<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:** [September 20, 2019, 7:07am UTC](https://discuss.elastic.co/t/search-request-get-only-objects-elements-inside-hits/196456/3 "2019-09-20T07:07:42Z")

</div>

Closed on September 20, 2019, 7:07am UTC

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