# How to make a search being executed on all nodes or a dedicate node?

**URL:** <https://discuss.elastic.co/t/how-to-make-a-search-being-executed-on-all-nodes-or-a-dedicate-node/57645>\
**Category:** Elasticsearch\
**Created:** [August 10, 2016, 3:08am UTC](https://discuss.elastic.co/t/how-to-make-a-search-being-executed-on-all-nodes-or-a-dedicate-node/57645 "2016-08-10T03:08:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![CharlieChen](https://avatars.discourse-cdn.com/v4/letter/c/3e96dc/32.png) [@CharlieChen](https://discuss.elastic.co/u/CharlieChen)\
**Post date:** [August 10, 2016, 3:08am UTC](https://discuss.elastic.co/t/how-to-make-a-search-being-executed-on-all-nodes-or-a-dedicate-node/57645/1 "2016-08-10T03:08:16Z")

</div>

I want a query being executed on each node, how to make it happened?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 10, 2016, 5:23am UTC](https://discuss.elastic.co/t/how-to-make-a-search-being-executed-on-all-nodes-or-a-dedicate-node/57645/2 "2016-08-10T05:23:59Z")

</div>

You cannot unless the data is distributed across all the nodes.

---

<div class="post-metadata">

**Author:** ![CharlieChen](https://avatars.discourse-cdn.com/v4/letter/c/3e96dc/32.png) [@CharlieChen](https://discuss.elastic.co/u/CharlieChen)\
**Post date:** [August 10, 2016, 6:55am UTC](https://discuss.elastic.co/t/how-to-make-a-search-being-executed-on-all-nodes-or-a-dedicate-node/57645/3 "2016-08-10T06:55:32Z")

</div>

Thank Mark.

I have set the replica = node numbers -1, and find a way to do this:  
GET /testindex/testype/\_search?pretty=true&preference=\_only\_node:MSVzS6W4QNGI40pMjN9Axw

The node id can be get with the following request:  
GET \_nodes

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 10, 2016, 10:08am UTC](https://discuss.elastic.co/t/how-to-make-a-search-being-executed-on-all-nodes-or-a-dedicate-node/57645/4 "2016-08-10T10:08:52Z")

</div>

Why are you even doing this though?

---

<div class="post-metadata">

**Author:** ![CharlieChen](https://avatars.discourse-cdn.com/v4/letter/c/3e96dc/32.png) [@CharlieChen](https://discuss.elastic.co/u/CharlieChen)\
**Post date:** [August 10, 2016, 2:53pm UTC](https://discuss.elastic.co/t/how-to-make-a-search-being-executed-on-all-nodes-or-a-dedicate-node/57645/5 "2016-08-10T14:53:20Z")

</div>

Hi Mark,

I leverage native script filter to implement a special filter logic, some caches are added internally to boost its performance, we need a way to invalidate some cache items basing on application side update, but the invalidation procedure needs to be applied on all ElasticSearch nodes to avoid inconsistency. Hope it explains.

Thanks,  
Charlie

---

<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, 10:28pm UTC](https://discuss.elastic.co/t/how-to-make-a-search-being-executed-on-all-nodes-or-a-dedicate-node/57645/6 "2017-07-05T22:28:45Z")

</div>


