Search Content by Date Range

96
1
Jump to solution
05-08-2018 08:28 PM
Highlighted
New Contributor III

I'm trying to search through my org content by a date range and the query doesn't appear to work.

No errors, but no returned results either.

Any ideas?

gis = GIS(portal, username, password)
cm = ContentManager(gis)

#modified: [2018-01-01 TO 2018-05-09]
cmItems = cm.search(query = 'modified: [1514728800000 TO 1525788000000]', max_items = 1000)
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Esri Contributor

Hi GIS Unit PSBA‌,

Try this code, it should work:

search_result = gis.content.search(query="modified: [1514728800000 TO 1525788000000]", max_items=1000)
Search_result‍‍

If Search_result outputs [ ] which is an empty list, this means there aren't any feature layers or items created between those dates.

I hope that helps.

View solution in original post

1 Reply
Highlighted
Esri Contributor

Hi GIS Unit PSBA‌,

Try this code, it should work:

search_result = gis.content.search(query="modified: [1514728800000 TO 1525788000000]", max_items=1000)
Search_result‍‍

If Search_result outputs [ ] which is an empty list, this means there aren't any feature layers or items created between those dates.

I hope that helps.

View solution in original post