# Thousand of where clauses

**URL:** <https://discuss.elastic.co/t/thousand-of-where-clauses/8665>\
**Category:** Elasticsearch\
**Created:** [August 8, 2012, 7:49am UTC](https://discuss.elastic.co/t/thousand-of-where-clauses/8665 "2012-08-08T07:49:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kim](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@kim](https://discuss.elastic.co/u/kim)\
**Post date:** [August 8, 2012, 7:49am UTC](https://discuss.elastic.co/t/thousand-of-where-clauses/8665/1 "2012-08-08T07:49:25Z")

</div>

In a project we are using elasticsearch and in some cases we have to create some queries with more than thousand of where clauses. I think we are not in the right way and there should be some solutions to avoid such huge amount of where clauses(e.g changing the design and the way we have stored the data). We don't know which record is stored on which nodes or shards, so we have to send such queries to all nodes.

Thanks

---

<div class="post-metadata">

**Author:** ![kim](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@kim](https://discuss.elastic.co/u/kim)\
**Post date:** [August 9, 2012, 12:57pm UTC](https://discuss.elastic.co/t/thousand-of-where-clauses/8665/2 "2012-08-09T12:57:40Z")

</div>

Nobody wants to to reply?!

---

<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, 3:16am UTC](https://discuss.elastic.co/t/thousand-of-where-clauses/8665/3 "2017-07-06T03:16:58Z")

</div>

Closed on July 6, 2017, 3:16am UTC


