Search

Description

This operation searches for content items in the portal. The searches are performed against a high performance index that indexes the most popular fields of an item. See the Search reference page for information on the fields and the syntax of the query.

The search index is updated whenever users add, update, or delete content. There can be a lag between the time that the content is updated and the time when it's reflected in the search results.

The results of a search only contain items that the user has permission to access.

Care should be taken when using ArcGIS REST API search operations (search, user search, group search, group content 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.

Request Parameters

ParameterDetails
[Common Parameters]

For a complete listing, see Common parameters.

q

Description: The query string used to search. Search requires q, bbox, or both.

Advanced search options

Example: q=redlands+map

bbox

The bounding box for a spatial search defined as minx, miny, maxx, or maxy. Search requires q, bbox, or both.

Spatial search is an overlaps/intersects function of the query bbox and the extent of the document.

Documents that have no extent (e.g., mxds, 3dds, lyr) will not be found when doing a bbox search.

Document extent is assumed to be in the WGS84 geographic coordinate system.

Example: bbox=-118,32,-116,34

categories

A JSON array or comma separated list of up to 8 org content categories to search items. Exact full path of each category is required, OR relationship between the categories specified.

Each request allows a maximum of 8 categories parameters with AND relationship between the different categories parameters called.

Example: search for items with water or forest category in the US

categories=/Categories/Water,/Categories/Forest
categories=/Region/US

or

categories: ["/Categories/Water", "/Categories/Forest"]
categories: ["/Region/US"]
categoryFilters

A comma separated list of up to 3 category terms to search items that have matching categories.

Up to 2 categoryFilters parameter are allowed per request. It can not be used together with categories to search in a request.

Example: search for items with categories having 'basemap' or 'ocean'

categoryFilters=basemap, ocean
start

The number of the first entry in the result set response. The index number is 1-based.

The default value of start is 1 (that is, the first search result).

The start parameter, along with the num parameter, can be used to paginate the search results.

Example: start=11 (returns result #11 as the first entry in the response)

num

The maximum number of results to be included in the result set response.

The default value is 10, and the maximum allowed value is 100.

The start parameter, along with the num parameter, can be used to paginate the search results.

Note:

The actual number of returned results may be less than num. This happens when the number of results remaining after start is less than num.

Specify num=0 if you are only interested in the total item counts matching a query and don't need to see any results. results will be empty if num=0.

Example: num=50 (returns a max of 50 results in the response)

sortField

Field to sort by. You can also sort by multiple fields (comma separated) for items, sort field names are case-insensitive.

Supported sort field names are title, created, type, owner, modified, avgrating, numratings, numcomments, and numviews.

sortOrder

Description: Describes whether the results return in ascending or descending order. Default is ascending.

Note:

This applies when working with sortField.

Values: asc | desc

countFields

A comma separated list of fields to count. Maximum count fields allowed per request is 3.

Supported count fields: tags, type, access, contentstatus, categories.

Example: countFields=categories, access

countSize

The maximum number of field values to count for each countFields.

The default value is 10, and maximum size allowed is 200.

Example: countSize=200

Response Properties

PropertyDetails
query

The query string searched.

total

The total number of results found for the whole query. The number of query results is limited to 10000.

start

The number of the first entry in the result set for this response. The index number is 1-based.

num

The number of results included in the result set for this response.

nextStart

The next entry index if the current result set doesn't contain all results.

results

A JSON array of item objects. See the response properties of an item.

Note:

ownerFolder, protected and commentsEnabled properties of an item are not included in search response.

aggregations

A counts JSON object that consists of an array of objects, one for each countFields requested. Each count field object has a fieldName and fieldValues properties with fieldName representing the count field and fieldValues consisting of an array for each field value along with its corresponding count.

Note:

Field values are counted case insensitively and are always returned lower cased. For instance, 'Basemap' and 'basemap' will be counted as 1 field value instead of 2.

aggregations is included in response when countFields is requested. It is recommended to only query for aggregated counts once per search query, i.e. on the first pagination batch or use with num=0 to empty the results for better performance.

Counts are approximate and are not always accurate.

Example:

{
    "counts": [{
        "fieldName": "contentstatus",
        "fieldValues": [
          {
            "value": "deprecated",
            "count": 4
          },
          {
            "value": "org_authoritative",
            "count": 2
          }
        ]
      },
      {
        "fieldName": "access",
        "fieldValues": [
          {
            "value": "private",
            "count": 59
          },
          {
            "value": "public",
            "count": 15
          },
          {
            "value": "account",
            "count": 6
          },
          {
            "value": "shared",
            "count": 2
          }
        ]
      }
    ]
  }

Example Usage

URL for Search

http://www.arcgis.com/sharing/rest/search?q=park&f=pjson

JSON Response Syntax

{
  "query": "<query string>",
  "total": <total number of results>,
  "start": <results in first set>,
  "num": <number of results per page>,
  "nextStart": <result number of next page>,
  "results": [
    {
      "id": "<item id>",
      "owner": "<owner username>",
      "created": date created shown in UNIX time,
      "modified": date modified shown in UNIX time,
      "guid": "<unique id>",
      "name": "<item name>",
      "title": "<item title>",
      "type": "<type>",
      "typeKeywords": ["<keyword1>", "<keyword2>", "<keyword3>", "<keyword4>"],
      "description": "<description>",
      "tags": ["<tag1>", "<tag2>", "<tag3>"],
      "snippet": "<summary>",
      "thumbnail": "<file name>",
      "extent": [
        [minX, minY],
        [maxX, maxY]
      ],
      "spatialReference": "<coordinate system>",
      "accessInformation": <credits>,
      "licenseInfo": "<access and use constraints>",
      "culture": "<culture code>",
      "url": <URL>,
      "proxyFilter": {},
      "access": "private | shared |  org | public",
      "size": <size>,
      "properties": {},
		    "appCategories": [],
		    "industries": [<list of industries>],
		    "languages": [<list of languages>],
		    "largeThumbnail": "<URL to thumbnail>",
		    "banner": "<URL to banner>",
		    "screenshots": [<list of URL to screenshots>],
		    "listed": true | false,
      "numComments": <number of comments>,
      "numRatings": <number of ratings>,
      "avgRating": <average rating>,
      "numViews": <number of views>
    }
  ]
}

JSON Response Example

{
  "query": "park",
  "total": 11,
  "start": 5,
  "num": 2,
  "nextStart": 7,
  "results": [
    {
      "id": "eca787aacf9b4c0a8817f36276609db3",
      "owner": "test",
      "created": 1224884011000,
      "modified": 1474327423000,
      "guid": "{578DF0AF-660E-4735-9A83-D48395774CA2}",
      "name": "yellowstone national park",
      "title": "Forest resources within the study area.",
      "type": "MapDocument mxd",
      "typeKeywords": ["mxd", "map", "arcmap"],
      "description": "This map is intended to be used as part of the ArcCatalog Quick start tutorial.",
      "tags": ["Yellowstone National Park", "U.S.", "vegetation", "hydrology", "inlandWaters"],
      "snippet": "<b>Yellowstone National Park</b>",
      "thumbnail": "thumbnail/yellowstone_map.png",
      "extent": [ 
         [-110.05, 44.13], 
         [-110, 44.98] 
      ],        
	     "spatialReference": null,       
      "accessInformation": null,        
      "licenseInfo": "ArcEditor is a powerful GIS desktop system for editing and managing geographic data.",    
      "culture": "en-US",       
      "url": null,   
      "proxyFilter": null,     
      "access": "public",   
      "size": 105,
      "properties": null,
		    "appCategories": [],
		    "industries": [],
		    "languages": [],
		    "largeThumbnail": null,
		    "banner": null,
		    "screenshots": [],
		    "listed": false,            
      "numComments": 5,        
      "numRatings": 16,        
      "avgRating": 3.25,        
      "numViews": 169  
    },
    {
      "id": "28c343b688224d0ca1b5ba741c28de6e",
      "owner": "jsmith33",
      "created": 1263460602000,
      "modified": 1474327425000,
      "guid": "1D70DAC0-505A-463F-A948-B324FD18BE2A",
      "name": "National_Parks_in_the_Northwest",
      "title": "National Parks in the Northwest",
      "type": "Layer Package",
      "typeKeywords": ["Data", "Layer Package", "ArcMap", "ArcGlobe", "ArcGIS Explorer", "lpk"],
      "description": null,
      "tags": ["Parks"],
      "snippet": null,
      "thumbnail": "thumbnail/thumbnail.png",
      "extent": [
           [-130.098, 15.469],
           [-63.337, 54.048]
      ],
      "spatialReference": "GCS_North_American_1983",
      "accessInformation": null,
      "licenseInfo": null,
      "culture": "en-us",
      "url": null,
      "proxyFilter": null,
      "access": "public",
      "size": 612,
      "properties": null,
		    "appCategories": [],
		    "industries": [],
		    "languages": [],
		    "largeThumbnail": null,
		    "banner": null,
		    "screenshots": [],
		    "listed": false,
      "numComments": 1,
      "numRatings": 6,
      "avgRating": 3,
      "numViews": 86
    }
   ]
}