# Terms lookup mechanism with multiple lookup docs

**URL:** <https://discuss.elastic.co/t/terms-lookup-mechanism-with-multiple-lookup-docs/17676>\
**Category:** Elasticsearch\
**Created:** [May 22, 2014, 1:45pm UTC](https://discuss.elastic.co/t/terms-lookup-mechanism-with-multiple-lookup-docs/17676 "2014-05-22T13:45:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Valery\_Ayala](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/valery_ayala/32/75433_2.png) [@Valery\_Ayala](https://discuss.elastic.co/u/Valery_Ayala)\
**Post date:** [May 22, 2014, 1:45pm UTC](https://discuss.elastic.co/t/terms-lookup-mechanism-with-multiple-lookup-docs/17676/1 "2014-05-22T13:45:37Z")

</div>

Is it possible to use this feature with a lookup on multiple documents  
(multiple IDs) to supply the terms?  
[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-terms-filter.html#\_terms\_lookup\_mechanism](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-terms-filter.html#_terms_lookup_mechanism)

I tried this  
"terms": {  
"user": {  
"index": "users",  
"type": "user",  
"id": [1,2,3,4],  
"path": "followers"  
}  
}

which was accepted as legit syntax, but only ONE of the ids was actually  
used within the terms filter (the last one in the list).

So far the only way I can come up with for doing this is using a bool  
filter and stuffing a bunch of these terms lookups into the "should" clause  
to accomplish the equivalent of multiple docs lookup.  
Is there a more efficient way?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/783c6825-c6db-4584-80ee-4dc710730c43%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/783c6825-c6db-4584-80ee-4dc710730c43%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:27am UTC](https://discuss.elastic.co/t/terms-lookup-mechanism-with-multiple-lookup-docs/17676/2 "2017-07-06T01:27:38Z")

</div>


