ArcGIS Portal content search with created date ranges not returning items

511
4
04-27-2020 04:06 AM
ChrisBuckmaster2
New Contributor III

I would like to search for content in ArcGIS Portal created within a specified date range.

On searching for a recent item, I can see that the field is formatted as a UNIX timestamp in milliseconds, so have just included a basic content search but it isn't working; the below code is what I am using after connecting already to Portal...

items = gis.content.search("created: '[1587285213000 TO 1587985213000]'")

for item in items:
    print(f"Title: {item.title}, Created: {item.created}")

When running the script, I do not receive any error messages, but I also do not receive any items - the time frame is between now and all of last week; content has been created in our portal last week so I am trying to work out what the issue might be?

Thanks

0 Kudos
4 Replies
JoshuaBixby
MVP Esteemed Contributor

Try:

items = gis.content.search("created: [1587285213000 TO 1587985213000]")
0 Kudos
ChrisBuckmaster2
New Contributor III

Hi Joshua

I removed the single quotes but that didn't change the outcome unfortunately.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

I am not sure what is going on then.  I just tried it locally including and dropping the single quotes, and both gave me the same results, which were not empty.

What version of ArcGIS API for Python are you using and what version of ArcGIS Portal?

0 Kudos
ChrisBuckmaster2
New Contributor III

I am using Portal version 10.6 and ArcGIS 1.6.0 in my production environment (I did also try it with ArcGIS 1.7.0 and 1.8.0 but again that didn't work either).

Upgrading Portal currently is not an option; I would have thought this date range search option would have existed in previous versions to so have my doubts that it would be the version?

0 Kudos