# Chained ES query/results

**URL:** <https://discuss.elastic.co/t/chained-es-query-results/195728>\
**Category:** Elasticsearch\
**Created:** [August 19, 2019, 11:19am UTC](https://discuss.elastic.co/t/chained-es-query-results/195728 "2019-08-19T11:19:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rosherd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rosherd/32/46087_2.png) [@rosherd](https://discuss.elastic.co/u/rosherd)\
**Post date:** [August 19, 2019, 11:19am UTC](https://discuss.elastic.co/t/chained-es-query-results/195728/1 "2019-08-19T11:19:40Z")

</div>

Hi,

If I have a \_location index, and a \_search index, is there a way to search the \_location index to say convert a language specific string like 'London' or 'Londres' to a number say 2543, and use this as part of the query into the \_search (e.g. location:2543) and return some detail also from the \_location index e.g. name,lat\_long etc

I can do this in Solr with SearchComponent and an EmbeddedSolrServer and would be keen to replicate in ES.

Cheers,  
Dan

---

<div class="post-metadata">

**Author:** ![rosherd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rosherd/32/46087_2.png) [@rosherd](https://discuss.elastic.co/u/rosherd)\
**Post date:** [August 19, 2019, 12:41pm UTC](https://discuss.elastic.co/t/chained-es-query-results/195728/2 "2019-08-19T12:41:08Z")

</div>

I think looking into this a bit further that it might require a custom QueryBuilder that uses org.elasticsearch.action.get.GetRequest similar to GeoShapeQueryBuilder or TermsQueryBuilder, has anyone pursued a similar answer this way perhaps?

---

<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 19, 2019, 12:47pm UTC](https://discuss.elastic.co/t/chained-es-query-results/195728/3 "2019-08-19T12:47:16Z")

</div>

hey,

if possible I would try to stay away from the query-within-query pattern and see if it can be solved on index time by enriching the document using a node ingest processor.

There is currently some work being done to enrich a document based on a query before indexing, see this issue [https://github.com/elastic/elasticsearch/issues/32789](https://github.com/elastic/elasticsearch/issues/32789)

--Alex

---

<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 16, 2019, 12:47pm UTC](https://discuss.elastic.co/t/chained-es-query-results/195728/4 "2019-09-16T12:47:19Z")

</div>

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