Carried over from: https://github.com/hashicorp/consul/issues/7958 by dariopb
I couldn’t find this behavior documented but I would expect that when I query KV and I set an index I would get only new entries or not found if timeout, instead every entry is returned:
c:\projects\k3s-win\cmd\agent>curl -v -X GET "http://127.0.0.1:8500/v1/kv/server?**recurse&index=9999&wait=2s**
Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8500 (#0)
> GET /v1/kv/server?recurse&index=0&wait=2s HTTP/1.1
> Host: 127.0.0.1:8500
> User-Agent: curl/7.55.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Vary: Accept-Encoding
**< X-Consul-Index: 6997**
< X-Consul-Knownleader: true
< X-Consul-Lastcontact: 0
< Date: Wed, 27 May 2020 02:38:14 GMT
< Content-Length: 732
<
[{"LockIndex":0,"Key":"server/0001","Flags":0,"Value":"J3tuYW1lOjAwMDF9Jw==","CreateIndex":6188,"ModifyIndex":6188},{"LockIndex":0,"Key":"server/0001/realm-0001","Flags":0,"Value":"J3tuYW1lOjAwMDF9Jw==","CreateIndex":6990,"ModifyIndex":6990},{"LockIndex":0,"Key":"server/0001/status","Flags":0,"Value":"J3tuYW1lOjAwMDF9Jw==","CreateIndex":6997,"ModifyIndex":6997},{"LockIndex":0,"Key":"server/0001/status/realm-0001","Flags":0,"Value":"J3tuYW1lOjAwMDF9Jw==","CreateIndex":6994,"ModifyIndex":6994},{"LockIndex":0,"Key":"server/0002","Flags":0,"Value":"J3tuYW1lOjAwMDJ9Jw==","CreateIndex":6189,"ModifyIndex":6189},{"LockIndex":0,"Key":"server/0002/free","Flags":0,"Value":"J3tuYW1lOjAwMDJ9Jw==","CreateIndex":6987,"ModifyIndex":6987}]* Connection #0 to host 127.0.0.1 left intact