# Enable indexing of metadata arrays

Metadata that is attached to content can be queried from the Vision API, providing a combination of visual and textual filtering of results.

For array field types the manual process of enabling indexing on these fields is required to ensure consistently high performance search requests.

# Why

Many customers use our API to store metadata that is used for display purposes only, and retrieve it with the fields parameter. This method reduces additional calls to their API, especially useful when calling the Vision API directly from the client-side.

To ensure the high-performance of the Vision API, metadata of array type fields are not automatically available for filtering by the Vision API. In the instances where the array metadata are not just for display purposes, one can enable a array field to be indexed along with expected values for querying via the Vision API.

To further ensure fast retrieval, a limit of 200 possible values across all fields is set per dataset. Please contact support to request an increase.

# Input

Endpoint

PUT /orgs/:organisation/datasets/:dataset/settings/fields

Field Type Required Value Description
organisation String yes The organisation name
dataset String yes The dataset name

# Body

Field Type Required Value Description
fields Object yes A key-value object of metadata fields and their values to index which will enable querying via the Vision API.
The value is an array of all possible values that will be searched on. To enable all values, set one value of *.
Please bare in mind that a limit applies per dataset (see above). See Querying for more information about using these fields.

# Example

{
  "fields":
  {
    "arrayField1": ["specific", "values", "to", "enable"],
    "arrayField2": ["*"]
  }
}

# Request

curl -X PUT \
     -H "Authorization: token my-org-api-token" \
     -H "Accept: application/vnd.visii.v2+json" \
     -d '{ "fields":{ "arrayField": ["possible", "values"], "arrayField2": ["*"] }}' \
     "https://api.visii.com/orgs/my-org/datasets/my-dataset/settings/fields"

# Response

Field Type Value Description
status String The status of the response
dataset Object The details of the dataset
dataset.browse_token String The authorization token needed when accessing this dataset via the Vision API. For security this token should be used when making client-side requests.
dataset.content_url String The URL for the content of the dataset. This is used to add new content.
dataset.name String The dataset name
dataset.processing_errors_url String The URL for the outstanding processing errors
dataset.settings Object The dataset settings
dataset.settings.fields Object The list of array fields and values enabled for querying
dataset.status String The current status of the dataset. Possible values are pending and published.
HTTP/1.1 200 OK
{
  "dataset": {
    "browse_token": "abcdefghijklmnopqrstuvwxyz123456789",
    "content_url": "https://api.visii.com/my-org/datasets/my-dataset/content",
    "name": "my-dataset",
    "processing_errors_url": "https://api.visii.com/orgs/my-org/datasets/my-dataset/errors",
    "settings": {
      "fields": {
        "arrayField": ["specific", "values", "to", "enable"],
        "arrayNumField": ["*"]
      },
      "version":1
    },
    "status": "published"
  },
  "status": "ok"
}
Last Updated: 6/30/2022, 12:24:16 PM