Search for an ip-address by custom field contains using the API returns all ip-addresses #6090

Closed
opened 2025-12-29 19:36:37 +01:00 by adam · 2 comments
Owner

Originally created by @jschewebbn on GitHub (Feb 15, 2022).

NetBox version

v3.1.7

Python version

3.9

Steps to Reproduce

We have a custom text field named CNAMEs.

https://netbox-host/api/ipam/ip-addresses/?cf_CNAMEs=something.test.site
Returns a single IP address as expected.

https://netbox-host/api/ipam/ip-addresses/?cf_CNAMEs__ic=something.test.site
Returns all ip addresses in our system. Should only return the single address found above.

Expected Behavior

The "__ic" match should only return a single address like the equal check.

Observed Behavior

All ip addresses are returned.

Originally created by @jschewebbn on GitHub (Feb 15, 2022). ### NetBox version v3.1.7 ### Python version 3.9 ### Steps to Reproduce We have a custom text field named CNAMEs. https://netbox-host/api/ipam/ip-addresses/?cf_CNAMEs=something.test.site Returns a single IP address as expected. https://netbox-host/api/ipam/ip-addresses/?cf_CNAMEs__ic=something.test.site Returns all ip addresses in our system. Should only return the single address found above. ### Expected Behavior The "__ic" match should only return a single address like the equal check. ### Observed Behavior All ip addresses are returned.
adam added the type: bug label 2025-12-29 19:36:37 +01:00
adam closed this issue 2025-12-29 19:36:38 +01:00
Author
Owner

@jschewebbn commented on GitHub (Feb 15, 2022):

The Filter Logic on this field is set to "Loose", which I believe is what I want as it is a field that contains a list of CNAMEs.

Doing more testing I see that using "__ie" also returns all ip-addresses, so perhaps I am misunderstanding the API documentation at https://netbox.readthedocs.io/en/stable/rest-api/filtering/

I also tried https://netbox-host/api/ipam/ip-addresses/?address__ic=10.30.0.11 and this returns all ip addresses as well.

@jschewebbn commented on GitHub (Feb 15, 2022): The Filter Logic on this field is set to "Loose", which I believe is what I want as it is a field that contains a list of CNAMEs. Doing more testing I see that using "__ie" also returns all ip-addresses, so perhaps I am misunderstanding the API documentation at https://netbox.readthedocs.io/en/stable/rest-api/filtering/ I also tried https://netbox-host/api/ipam/ip-addresses/?address__ic=10.30.0.11 and this returns all ip addresses as well.
Author
Owner

@jschewebbn commented on GitHub (Feb 17, 2022):

Changing the "Filter Logic" property on the custom field from "Loose" to "Exact" is caused the "__ic" search to work. I'm not sure why, but it's working.

@jschewebbn commented on GitHub (Feb 17, 2022): Changing the "Filter Logic" property on the custom field from "Loose" to "Exact" is caused the "__ic" search to work. I'm not sure why, but it's working.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6090