# Is there a way to mimic the \_source path for \_search in a specific document?

**URL:** <https://discuss.elastic.co/t/is-there-a-way-to-mimic-the--source-path-for--search-in-a-specific-document/36645>\
**Category:** Elasticsearch\
**Created:** [December 8, 2015, 2:39pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-mimic-the--source-path-for--search-in-a-specific-document/36645 "2015-12-08T14:39:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![redolcas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redolcas/32/6466_2.png) [@redolcas](https://discuss.elastic.co/u/redolcas)\
**Post date:** [December 8, 2015, 2:39pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-mimic-the--source-path-for--search-in-a-specific-document/36645/1 "2015-12-08T14:39:19Z")

</div>

The resource /users/1/\_source will return data WITHOUT ANY METADATA, like:

```
{
   "id" : 1,
   "name" : "John"
}

```

There is a way to get an array of sources WITHOUT ANY METADATA if a search is submitted to a specific document (e.g., /users/\_search )? The expected result will be something like:

```
[
   {
       "id" : 1,
       "name" : "John"
   },
   {
       "id" : 2,
       "name" : "Mark"
   },
   {
       "id" : 3,
       "name" : "Ana" 
   }
]

```

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [December 8, 2015, 2:52pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-mimic-the--source-path-for--search-in-a-specific-document/36645/2 "2015-12-08T14:52:10Z")

</div>

Like this plugin?

> **[jprante/elasticsearch-arrayformat](https://github.com/jprante/elasticsearch-arrayformat)**
>
> elasticsearch-arrayformat - REST array format for search responses

---

<div class="post-metadata">

**Author:** ![redolcas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redolcas/32/6466_2.png) [@redolcas](https://discuss.elastic.co/u/redolcas)\
**Post date:** [December 8, 2015, 3:01pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-mimic-the--source-path-for--search-in-a-specific-document/36645/3 "2015-12-08T15:01:26Z")

</div>

Hi, Jörg.

Exactly. I tried to use your plugin in ES 2.1, but got this error:

`ERROR: Could not find plugin descriptor 'plugin-descriptor.properties' in plugin zip`

But I was wondering if there is a way to do that in ES 2.1 directly. I've checked many old threads about this subject, so I just want to be sure that this still isn't possible for 2.1 before I go to other directions.

Thanks for your answer.

---

<div class="post-metadata">

**Author:** ![redolcas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redolcas/32/6466_2.png) [@redolcas](https://discuss.elastic.co/u/redolcas)\
**Post date:** [December 8, 2015, 3:15pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-mimic-the--source-path-for--search-in-a-specific-document/36645/4 "2015-12-08T15:15:14Z")

</div>

It is possible to use the arrayformat plugin with the JAVA API for ES or I will have to use plain Java networking to do that?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [December 8, 2015, 3:17pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-mimic-the--source-path-for--search-in-a-specific-document/36645/5 "2015-12-08T15:17:51Z")

</div>

I have to upgrade the plugin to ES 2.1.

It's HTTP, no Java API.

With Java, you can iterate through the hits, the "metadata problem" does not exist.

---

<div class="post-metadata">

**Author:** ![redolcas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redolcas/32/6466_2.png) [@redolcas](https://discuss.elastic.co/u/redolcas)\
**Post date:** [December 8, 2015, 3:39pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-mimic-the--source-path-for--search-in-a-specific-document/36645/6 "2015-12-08T15:39:04Z")

</div>

My question wasn't good, probably because my english isn't good. 🙂

Currently I'm using the ES Java API to make HTTP requests to ES (e.g. a \_search endpoint in some document). I was wondering if could be possible use your plugin with the ES JAVA API. Something like this: [https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-search.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-search.html)

But I think I will have to write plain Java requests (without the ES Java API) to use your plugin, because `client.prepareSearch(...)` will result in a HTTP \_search.

Thanks.

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [December 8, 2015, 3:45pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-mimic-the--source-path-for--search-in-a-specific-document/36645/7 "2015-12-08T15:45:02Z")

</div>

Your english is good, I understand, at least I hope so 😄

Java is not using HTTP `_search`, it uses transport protocol (native Elasticsearch node-to-node protocol) over port 9300.

With Java search API, you get a `SearchResponse` object. From there you can iterate through the search hits. Therefore, you can see hits as an array. No metadata like `_index`, `_type`, `_id` are in the way, like in JSON hits, which are transported over HTTP API.

---

<div class="post-metadata">

**Author:** ![redolcas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redolcas/32/6466_2.png) [@redolcas](https://discuss.elastic.co/u/redolcas)\
**Post date:** [December 8, 2015, 3:49pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-mimic-the--source-path-for--search-in-a-specific-document/36645/8 "2015-12-08T15:49:54Z")

</div>

I didn't know that, I'm new to ElasticSearch world. Thanks!

---

<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 5, 2017, 11:32pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-mimic-the--source-path-for--search-in-a-specific-document/36645/9 "2017-07-05T23:32:34Z")

</div>


