Indexes

Create geo-spatial index

Create a geo index.

Note: Geo indexes are always sparse, meaning that documents that do not contain the index attributes or have non-numeric values in the index attributes are not indexed.

post/_fabric/{fabric}/_api/index/geo

Request

Path parameters

fabricstring string required

The name of the fabric.

Query parameters

collectionstring required

The collection name.

Request body

fieldsstring[]

An array with one or two attribute paths.

If it is an array with one attribute path location, a geo-spatial index on all documents is created using location as path to the coordinates. The value of the attribute must be an array with at least two double values. The array must contain the latitude (first value) and the longitude (second value). All documents, that do not have the attribute path or with value that are not suitable, are ignored.

If it is an array with two attribute paths latitude and longitude, a geo-spatial index on all documents is created using latitude and longitude as paths the latitude and the longitude. The value of the attribute latitude and of the attribute longitude must a double.

Note: All documents, that do not have the attribute paths or which values are not suitable, are ignored. If it is an array with two attribute paths latitude and longitude, a geo-spatial index on all documents is created using latitude and longitude as paths the latitude and the longitude. The value of the attribute latitude and longitude must be a double. All documents that do not have the attribute paths or which values are not suitable are ignored.

geoJsonstring

If a geo-spatial index on a location is constructed and geoJson is true, the order within the array is longitude followed by latitude. This corresponds to the format described in http://geojson.org/geojson-spec.html#positions.

typestring required

Must be equal to "geo".

Response

Successfully fetched existing geo index.

codeinteger

HTTP response code.

errorboolean

Flag if there is an error in response. False for this response.

geoJsonboolean

If a geo-spatial index on a location is constructed and geoJson is true, the order within the array is longitude followed by latitude. This corresponds to the format described in http://geojson.org/geojson-spec.html#positions.

fieldsstring[]

HTTP response code.

maxNumCoverCellsinteger

The maximum number of cover cells.

worstIndexedLevelinteger

The worst indexed level.

idstring

Index identifier.

namestring

Name of the index.

selectivityEstimatenumber

The selectivity estimate of index.

sparseboolean

True if index is sparse type.

typestring

Index type.

uniqueboolean

True if index is unique.

Example response

{
  "code": 200,
  "geoJson": true,
  "fields": [
    "_key"
  ],
  "maxNumCoverCells": 8,
  "worstIndexedLevel": 4,
  "id": "61862387",
  "name": "idx_1723573111790501888",
  "selectivityEstimate": 1,
  "sparse": true,
  "type": "fulltext",
  "unique": true
}

Changes

No recorded changes to this operation across all 1 revision of this API.