Search on Contentful for null/not null fields

Hi there,

On Contentful website, I would like to filter by a field that is/is not null.
Is that possible?

2 Likes

Hi @kennedy,

This is not a possibility directly through our Web Interface, but you could do that using our Delivery or Management APIs with the existence parameter:

https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/existence

That’s something I’ve needed on a number of occasions too and have previously enquired about. @gabriel is it it a query you get a lot and is there any prospect of it making it onto the UI roadmap?

4 Likes

Any chance this will be implemented in the future? I’ve had a lot of use cases for this… :confused:

BTW, for anyone getting here via a desperate google search, here’s my workaround:

  • Open the content panel in the contentful web view
  • Filter for the content type in question (e.g. clients)
  • Open Dev Tools
  • Go to network tab
  • Look for the corresponding entries request (should have content_type={client} as URL param)
  • Right click -> Open the request in a new tab
  • Add &{field you want to filter}[exists]=true to the URL params

In the end, your URL should look something like this:
https://api.contentful.com/[...]/entries?content_type=client&access_token={access token}&fields.company[exists]=true (where client and company are examplary values)

BTW you can get an access token for this kind of request from the authorization request header of the entries request (omit the Bearer keyword)

2 Likes

Hi @lukas.mueller, @scott.hogan. Since it seems this feature is interesting, I will forward this request to our Product team and keep you updated in this post.

3 Likes

Any updates on if this has been implemented in the web UI?

3 Likes

it should not be too difficult for your engineering team to add an “is empty” option to the data-search-filter-role=“operator” list - the lack of this makes it very cumbersome to work with large amounts of data.

3 Likes

Any news on this? Our Editors would love to be able to do this as the need to find entries where certain fields do/don’t have content has come up several times.

6 Likes

This is sorely lacking, please prioritize this feature

3 Likes

Any news on this? We also would love to use functionality like this.

3 Likes

Adding my voice to this. Please add this feature.

2 Likes

We’d use this feature all the time at Notion.

Any update on this? It is hard to understand how this is not an option…

2 Likes

I use this little trick. Add the field to the grid, then sort by that field. The records with that field empty should be at the top. Sorting with boolean (yes/no) empty value is always at the bottom of the grid, so you will have to page to end.

1 Like

@dlam you geniiuuus!!

@dlam2 Not all fields are sortable. Have any ideas for showing and sorting entries that don’t have a media asset (Image) attached?

This would be very useful for filtering for images without alt text