Search reference

Overview

The ArcGIS Portal API has a full-featured text search engine that provides the ability to create your own queries.

Care should be taken when using ArcGIS REST API search operations (search, user search, group search) to find items, groups, and users programmatically. The Portal uses a powerful search engine to index information and to allow full text searching on it. This search engine uses many different inputs to find the appropriate results and rank them. This often makes search 'fuzzy', making it ideal for human interaction, but not necessarily ideal for looking for specific records programmatically. Developers should avoid using search to find specific items (e.g. by title) as the results of these types of queries might change as the search engine evolves.

Terms

A query is broken up into terms and operators. There are two kinds of terms: single term and phrase.

A single term is a single word, such as "fire" or "California".

A phrase is a group of words. To create a phrase, surround multiple words with double quotes, such as "fire maps". Single quotes are not supported for a multiple word search.

Multiple terms can be combined with Boolean operators to form a more complex query (see below).

Fields

When performing a search for items or groups, you can either specify a field or use the default fields. For items, the default fields are title, tags, snippet, description, accessinformation, spatialreference, type, and typekeywords. For groups, the default fields are id, title, description, snippet, tags, and owner. The best match is always returned. For example, a search for "fires" would return records containing "fire."

You can search any field by typing the field name followed by a colon ":" and the search term. If you don't use a field indicator, the default fields will be searched.

As an example, to search for an item that has San Francisco in the title and is a layer package, the query would be as follows:

{
  title:"San Francisco" AND type:"layer package"
}

The field is only valid for the term that it directly precedes.

Term Modifiers

A number of term modifiers are supported to provide a wide range of searching options.

Wildcard Searches

Single and multiple character wildcard searches within single terms (not within phrase queries) are supported.

To perform a single character wildcard search, use the "?" symbol.

To perform a multiple character wildcard search, use the "*" symbol.

The single character wildcard and the multiple character wildcard cannot be used in the same search.

Range Searches

Range searches allow you to match a single field or multiple field values between the lower and upper bound. Range queries can be inclusive or exclusive of the upper and lower bounds. Inclusive range queries are denoted by square brackets. Exclusive range queries are denoted by curly brackets.

For example, to find all items created between December 1, 2009, and December 9, 2009, the search expression would be as follows:

{
  uploaded: [0000001259692864000 TO 0000001260384065000]
}

The created field contains the date and time an item is created in UNIX time. UNIX time is defined as the number of seconds that have elapsed since midnight January 1, 1970. The portal stores time in milliseconds, so you need to add three zeros to the end of the UNIX time. Additionally, you need to pad six zeros on the front of the number. This is because the number is stored as a string in the database.

Range searches are not reserved for date fields. You can also use range queries with non-date fields:

{
  owner:{arcgis_explorer TO esri}
}

This will find all items from the owners between arcgis_explorer and esri, not including arcgis_explorer and esri.

Boosting a Term

Boosting allows you to control the relevance of an item by boosting its term. To boost a term, use the caret (^) symbol with a boost factor (a number) at the end of the term you are searching. The higher the boost factor, the more relevant the term will be. For example, if you're searching for "recent fires" and want "fires" to be more relevant, create the following expression:

{
  recent fires^5
}

You can also boost phrase terms. Although the boost factor must be positive, it can be less than 1 (for example, 0.2).

Boolean Operators

Boolean operators allow terms to be combined through logic operators. The Portal API supports AND, OR, "+", NOT, and "-" as Boolean operators. Boolean operators must be ALL CAPS.

AND

The AND operator is the default conjunction operator. This means that if there is no Boolean operator between two terms, the AND operator is used. The AND operator performs matching where both terms exist in either the given field or the default fields. This is equivalent to an intersection using sets.

To search for an item that contains the terms "recent" and "fires," use the following query:

{
  recent fires
}

or

{
  recent AND fires
}

OR

The OR operator links two terms and finds a match if either term exists. This is equivalent to a union using sets.

To search for an item that contains the terms "recent fires" or"fires," use the following query:

{
  "recent fires" OR fires
}

+

The "+", or the required operator, requires that the term after the "+" symbol exist somewhere in the given field or the default fields.

To search for items that must contain "fires" and may contain "recent", use the following query:

{
  recent +fires 
}

NOT

The NOT operator excludes items that contain the term after NOT. This is equivalent to a difference using sets.

To search for documents that contain "California" but not "Imagery", use the following query:

{
  California NOT Imagery
}

The NOT operator cannot be used with just one term.

-

The "-", or the prohibit operator, excludes items that contain the term after the "-" symbol.

To search for documents that contain "California" but not "Imagery" use the following query:

{
  California -Imagery
}

Grouping

You can create sub queries using parentheses to group clauses. This can be useful if you want to control the Boolean logic for a query.

To search for either "California" or "recent" and "fires," create the following expression:

{
  (California OR recent) AND fires
}

Field Grouping

You can group multiple clauses to a single field using parentheses.

To search for a title that contains the phrase "population change" and the word "recent," use the following query:

{
  title:(+"population change" +recent)
}

Item Fields

You can refine your item searches by using specific fields in your search string. These fields include the following:

Field

Details

id

ID of the item, for example, id:4e770315ad9049e7950b552aa1e40869 returns the item for that ID.

itemtype

Item type can be URL, text, or file. See Items and item types for a listing of the different types. This field is predefined. For example, itemtype:file return items of the type file.

owner

Owner of the item, for example, owner:esri returns all content published by esri.

uploaded

Uploaded is the date uploaded, for example uploaded: [0000001249084800000 TO 0000001249548000000] finds all items published between August 1, 2009, 12:00AM to August 6, 2009 08:40AM.

title

Item title, for example, title:"Southern California" returns items with Southern California in the title.

type

Type returns the type of item and is a predefined field. See Items and item types for a listing of the different types. For example, type:map returns items with map as the type, such as map documents and map services.

typekeywords

Type keywords, for example, typekeywords:tool returns items with the tool type keyword such as Network Analysis or geoprocessing services. See Items and item types for a listing of the different types.

description

Item description, for example, description:California finds all items with the term California in the description.

tags

The tag field, for example, tags:"San Francisco" returns items tagged with the term San Francisco.

snippet

Snippet or summary of the item, for example, snippet:"natural resources" returns items with natural resources in the snippet.

spatialreference

Spatial reference, for example, spatialreference:102100 returns items in the Web Mercator Auxiliary Sphere projection.

accessinformation

Access information, for example, accessinformation:esri returns items with esri as the source credit.

access

The access field, for example, access:public returns public items. This field is predefined, and the options are public, private, org, or shared. You will only see private or shared items that you can access.

group

The ID of the group, for example, group:1652a410f59c4d8f98fb87b25e0a2669 returns items within the given group.

numratings

Number of ratings, for example, numratings:6 returns items with six ratings.

numcomments

Number of comments, for example, numcomments:[1 TO 3] returns items that have one to three comments.

avgrating

Average rating, for example, avgrating:3.5 returns items with 3.5 as the average rating.

culture

Culture, for example, culture:en-US, returns the locale of the item. The search engine treats the two parts of the culture code as two different terms, and searches for individual languages can be done. For example, culture:en returns all records that have an "en" in their culture code. There may be overlaps between the codes used for language and the codes used for country, for instance fr-FR, but if the client needs to target a code with this problem, they can pass in the complete code.

orgid

The ID of the organization, for example, orgid:5uh3wwYLNzBuU0Ef returns items within the given organization.

Group Fields

You can filter your searches on groups by using specific fields in your search string. Only public groups or groups to which you have access will be searched. These fields include the following:

Field

Details

id

Group ID, for example, id:1db70a32f5f84ea9a88f5f460f22557b returns the group for that ID.

title

Group title, for example, title:redlands returns groups with redlands in the title.

owner

Group owner, for example, owner:esri returns groups owned by esri.

description

Description, for example, description:"street maps" returns groups with street maps in the description field.

snippet

Snippet or summary of the group, for example,snippet:transportation returns groups with transportation in the snippet field.

tags

The tag field, for example, tags:"bike lanes" returns groups tagged with the term bike lanes.

phone

Contact info, for example, phone:jsmith33@esri.com returns groups with jsmith33@esri.com as the phone or group contact information. It can be a mix of letters and numbers.

created

Date created, for example, created:0000001247085176000 returns groups created on July 8, 2009.

access

The access field returns either public, organization, or private groups. For example, access:org returns groups shared with the organization. This field is predefined with the options private, org, or public.

isinvitationonly

The isinvitationonly field returns groups that require an invitation to join. For example, isinvitationonly:false returns groups that do not require an invitation to join. This field is predefined with the options true or false.

orgid

The ID of the organization, for example, orgid:5uh3wwYLNzBuU0Ef returns groups within the given organization.

10/6/2017