list-query-rulesets.asciidoc 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. [role="xpack"]
  2. [[list-query-rulesets]]
  3. === List query rulesets
  4. preview::[]
  5. ++++
  6. <titleabbrev>List query rulesets</titleabbrev>
  7. ++++
  8. Returns information about all stored query rulesets.
  9. Summary information on the number of rules per ruleset will be returned, and full details can be returned with the <<get-query-ruleset>> command.
  10. [[list-query-rules-request]]
  11. ==== {api-request-title}
  12. `GET _query_rules/`
  13. [[list-query-rules-prereq]]
  14. ==== {api-prereq-title}
  15. Requires the `manage_search_query_rules` privilege.
  16. [[list-query-rules-path-params]]
  17. ==== {api-path-parms-title}
  18. `size`::
  19. (Optional, integer) Maximum number of results to retrieve.
  20. `from`::
  21. (Optional, integer) The offset from the first result to fetch.
  22. [[list-query-rules-example]]
  23. ==== {api-examples-title}
  24. The following example lists all configured query rulesets:
  25. [source,console]
  26. ----
  27. GET _query_rules/
  28. ----
  29. // TEST[skip:TBD]
  30. The following example lists the first three query rulesets:
  31. [source,console]
  32. ----
  33. GET _query_rules/?from=0&size=3
  34. ----
  35. // TEST[skip:TBD]
  36. A sample response:
  37. [source,console-result]
  38. ----
  39. {
  40. "count": 4,
  41. "results": [
  42. {
  43. "ruleset_id": "ruleset-1",
  44. "rule_total_count": 10,
  45. "rule_criteria_types_counts: {
  46. "exact": 5,
  47. "fuzzy": 5
  48. }
  49. },
  50. {
  51. "ruleset_id": "ruleset-2",
  52. "rule_total_count": 15,
  53. "rule_criteria_types_counts: {
  54. "exact": 5,
  55. "fuzzy": 10,
  56. "gt": 4
  57. }
  58. },
  59. {
  60. "ruleset_id": "ruleset-3",
  61. "rule_total_count": 5,
  62. "rule_criteria_types_counts: {
  63. "exact": 1,
  64. "contains": 4
  65. }
  66. }
  67. ]
  68. }
  69. ----
  70. // TEST[skip:TBD]
  71. [NOTE]
  72. The counts in `rule_criteria_types_counts` may be larger than the value of `rule_total_count`, because a rule may have multiple criteria.