query-api-key.asciidoc 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. --
  2. :api: query-api-key
  3. :request: QueryApiKeyRequest
  4. :response: QueryApiKeyResponse
  5. --
  6. [role="xpack"]
  7. [id="{upid}-{api}"]
  8. === Query API Key information API
  9. API Key(s) information can be queried and retrieved in a paginated
  10. fashion using this API.
  11. [id="{upid}-{api}-request"]
  12. ==== Query API Key Request
  13. The +{request}+ supports query and retrieving API key information using
  14. Elasticsearch's {ref}/query-dsl.html[Query DSL] with
  15. {ref}/paginate-search-results.html[pagination].
  16. It supports only a subset of available query types, including:
  17. . {ref}/query-dsl-bool-query.html[Boolean query]
  18. . {ref}/query-dsl-match-all-query.html[Match all query]
  19. . {ref}/query-dsl-term-query.html[Term query]
  20. . {ref}/query-dsl-terms-query.html[Terms query]
  21. . {ref}/query-dsl-ids-query.html[IDs Query]
  22. . {ref}/query-dsl-prefix-query.html[Prefix query]
  23. . {ref}/query-dsl-wildcard-query.html[Wildcard query]
  24. . {ref}/query-dsl-range-query.html[Range query]
  25. ===== Query for all API keys
  26. In its most basic form, the request selects all API keys that the user
  27. has access to.
  28. ["source","java",subs="attributes,callouts,macros"]
  29. --------------------------------------------------
  30. include-tagged::{doc-tests-file}[query-api-key-default-request]
  31. --------------------------------------------------
  32. ===== Query API keys with Query DSL
  33. The following query selects API keys owned by the user and also satisfy following criteria:
  34. * The API key name must begin with the word `key`
  35. * The API key name must *not* be `key-20000`
  36. ["source","java",subs="attributes,callouts,macros"]
  37. --------------------------------------------------
  38. include-tagged::{doc-tests-file}[query-api-key-query-request]
  39. --------------------------------------------------
  40. ===== Retrieve API keys with explicitly configured sort and paging
  41. The following request sort the API keys by their names in descending order.
  42. It also retrieves the API keys from index 1 (zero-based) and in a page size of 100.
  43. ["source","java",subs="attributes,callouts,macros"]
  44. --------------------------------------------------
  45. include-tagged::{doc-tests-file}[query-api-key-from-size-sort-request]
  46. --------------------------------------------------
  47. ===== Deep pagination can be achieved with search after
  48. ["source","java",subs="attributes,callouts,macros"]
  49. --------------------------------------------------
  50. include-tagged::{doc-tests-file}[query-api-key-search-after-request]
  51. --------------------------------------------------
  52. include::../execution.asciidoc[]
  53. [id="{upid}-{api}-response"]
  54. ==== Query API Key information API Response
  55. The returned +{response}+ contains the information regarding the API keys that were
  56. requested.
  57. ["source","java",subs="attributes,callouts,macros"]
  58. --------------------------------------------------
  59. include-tagged::{doc-tests-file}[query-api-key-from-size-sort-response]
  60. --------------------------------------------------
  61. <1> Total number of API keys matched by the query
  62. <2> Number of API keys returned in this response
  63. <3> The list of API keys
  64. <4> If sorting is requested, each API key in the response contains its sort values.