# Get elastic search document ID and Engine ID

**URL:** <https://discuss.elastic.co/t/get-elastic-search-document-id-and-engine-id/227662>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [April 12, 2020, 9:54am UTC](https://discuss.elastic.co/t/get-elastic-search-document-id-and-engine-id/227662 "2020-04-12T09:54:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wickerman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wickerman/32/66173_2.png) [@wickerman](https://discuss.elastic.co/u/wickerman)\
**Post date:** [April 12, 2020, 9:54am UTC](https://discuss.elastic.co/t/get-elastic-search-document-id-and-engine-id/227662/1 "2020-04-12T09:54:13Z")

</div>

Hello,

I'm currently learning AppSearch so that I can use it for a certain project.  
So far so good, but I've hit a wall. One thing I know is that AppSearch indexes  
documents to elasticsearch. But I find AppSearch to be more opinionated in terms  
of how flexible you'll be with the documents. For context sake, my use case is as below.

We index different products using AppSearch because it does a lot of the hard work for us in the background when creating mappings and documents into elasticsearch. But you cannot run more advanced queries through appsearch like you would with elasticsearch.

Consider a query like this that is meant to find documents that are like the document with **\_id** : _xxxxx_ from a certain **\_index** : _xxxxxxx_:

 ![kibana_1](https://us1.discourse-cdn.com/elastic/original/3X/d/b/dbf6f0361feb675b12aa0ecd83381e86f06a5520.png)

From the results, I see that AppSearch actually has the engine\_id and the id of the document as indexed into elasticsearch.

As seen Here from field id and engine\_id:  
 ![kibana_2](https://us1.discourse-cdn.com/elastic/original/3X/7/f/7f688b76acfabc58270386204b8ad6f5812cae44.png)

Now that you have an idea of the nature of my problem, My question is:

How can Retrieve the engine\_id and id of the document so that I can reuse the same indices and ids from elasticsearch to run more complex queries?

Thank you.

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [April 13, 2020, 12:41pm UTC](https://discuss.elastic.co/t/get-elastic-search-document-id-and-engine-id/227662/2 "2020-04-13T12:41:59Z")

</div>

App Search in its current state is built in such a way that the underlying Elasticsearch indexes are not meant to be queried directly. So you'll definitely run into challenges going this direction.

What sort of Advanced Queries are you trying to run?

---

<div class="post-metadata">

**Author:** ![wickerman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wickerman/32/66173_2.png) [@wickerman](https://discuss.elastic.co/u/wickerman)\
**Post date:** [April 13, 2020, 1:14pm UTC](https://discuss.elastic.co/t/get-elastic-search-document-id-and-engine-id/227662/3 "2020-04-13T13:14:50Z")

</div>

Any query from aggregations to the likes of more\_like\_this. Which I see Appsearch does not support yet.

But if it were possible to expose just the engine\_id, and the id of the document as indexed in elasticsearch wouldn't that enable a whole range of possibilities for inter-operating elasticsearch and appsearch? As one can easily reference the document in elasticsearch for other use cases that are currently not available via appsearch.

Just thinking...

---

<div class="post-metadata">

**Author:** ![wickerman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wickerman/32/66173_2.png) [@wickerman](https://discuss.elastic.co/u/wickerman)\
**Post date:** [April 13, 2020, 1:18pm UTC](https://discuss.elastic.co/t/get-elastic-search-document-id-and-engine-id/227662/4 "2020-04-13T13:18:53Z")

</div>

And your answer brings me to another question, what strategies can we use to have these data indexed by appsearch and still be reusable to query them directly using elasticsearch?

Do we feed them to both elasticsearch and appsearch when indexing? like one specifically for search (appsearch) and the other for other direct query uses (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:** [May 11, 2020, 1:19pm UTC](https://discuss.elastic.co/t/get-elastic-search-document-id-and-engine-id/227662/5 "2020-05-11T13:19:07Z")

</div>

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