[ZBX-19627] API doesn't specify if filtering is done by and/or Created: 2021 Jul 01  Updated: 2021 Oct 15

Status: Confirmed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A), Documentation (D)
Affects Version/s: 5.0.13, 5.4.2
Fix Version/s: None

Type: Incident report Priority: Minor
Reporter: Edgars Melveris Assignee: Zabbix Development Team
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate

 Description   

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.


Generated at Sun Aug 03 03:41:06 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.