Couchbase has an Index Statistics API (https://docs.couchbase.com/server/current/rest-api/rest-index-stats.html). The stats have just what I’m looking for, but I have run into an issue when an index has been created with replicas.
When created with replicas (e.g. WITH { "num_replica": 1}
), then when using the Console or the API you’ll see multiple indexes that include the replica. This reflects the fact that different nodes are in play for the main index and the replica, especially when there are multiple indexers or partitioning. For example, you might have cdr_by_direction_and_time_v1
and cdr_by_direction_and_time_v1 (replica 1)
. Those are the ACTUAL names that come back from the API.
I want to be able to hit the Index Statistics API for each of those indexes to get back partition and node details on each separately. The problem is that the API doesn’t seem to be able to handle the two different names, and calls to the API for the name cdr_by_direction_and_time_v1
seem to sometimes return the primary, and sometimes return the data for the replica. Attempts to encode cdr_by_direction_and_time_v1 (replica 1)
in the URL just cause calls to fail.
Has anyone been able to use these API’s predictably with replicas? To be able to get the stats on each of the two indexes?