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

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

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

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

Why are you even doing this though?

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.