How can I filter for Nodes with all checks passing on `/health/service/:service` endpoint?

Deprecated - Use filter with the Checks.Status selector instead. This parameter will be removed in a future version of Consul. Specifies that the server should return only nodes with all checks in the passing state. This can be used to avoid additional filtering on the client side.

According to the docs, it seems like the passing params has been deprecated and we’re recommended to use the filter with the Checks.Status selector. However, the filtering is done against each entry in the Checks array as per the following line in the docs:

The filter will be executed against each entry in the top level results list

This means that filter=Checks.Status == "passing" will return a node as long as any check for the node is in the passing state. This is quite different from the passing parameter where it’ll only return nodes with all checks in the passing state. Is there a way for us to do the same by filtering?

Thank you!

Thank you for the question! For now I would continue using the passing query param.

As you point out it won’t be possible to use the filter query param for this purpose, so we’ll need to update the docs to remove the deprecation.

1 Like