Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-19627

API doesn't specify if filtering is done by and/or

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 5.0.13, 5.4.2
    • API (A), Documentation (D)
    • None

      In API documentation for host.get method:
      https://www.zabbix.com/documentation/current/manual/api/reference/host/get
      it does not clearly specify if the filters are applied with "and"or "or" relationship.

      The term used there is confusing, for example for groupids

      Return only hosts that belong to the given groups.

      Can be interpreted as returning only hosts that belong to ALL listed grouid's ("and" relationship) while in reality it returns all hosts that belong to ANY of the given groupids.

      There is also another option which in this case doesn't make much sense:
      https://www.zabbix.com/documentation/current/manual/api/reference_commentary

      searchByAny boolean If set to true return results that match any of the criteria given in the filter or search parameter instead of all of them.
      Default: false.

      This suggests that by default search should use "AND" and only switch to "OR" if this is enabled.

      There should be an option to search using "AND" parameter and the behavior should be clearly documented.

            zabbix.dev Zabbix Development Team
            zux Edgars Melveris
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: