Is it possible to restrict item types in gis.content.search?

424
3
09-17-2019 01:18 PM
ThomasColson
MVP Frequent Contributor

For example, I'm wanting to 

itemsList = gis.content.search(query = 'created: [1514768400000 TO 1546218000000]',
 max_items = 10000000,
 item_type != 'Image Collection')

which returns

0 Kudos
3 Replies
DanPatterson_Retired
MVP Emeritus
itemsList = gis.content.search('created: [1514768400000 TO 1546218000000]',
 max_items = 10000000,
 item_type != 'Image Collection')

from the error message only, it looks like the first parameter just wants the string with the parameter = bit

From the help topic on dir(gis.content.search)

 Definition : search(query, item_type=None, sort_field='avgRating', sort_order='desc', max_items=10, outside_org=False, categories=None, category_filters=None)

0 Kudos
ThomasColson
MVP Frequent Contributor

So would the conclusion be no, it is not possible to use exclusion operators in 

gis.content.search?
0 Kudos
HenryLindemann
Esri Contributor

You just add the query string inside the quotes.

search_result = gis.content.search(query="owner:some_user NOT Feature Service")

Search reference—ArcGIS REST API: Users, groups, and content | ArcGIS for Developers 

inside the () you can only use = it is just an assignment parameter_1=some_value

0 Kudos