Table of contents

Scroll API

Overview

To search the metadata in the GrayMeta Platform, and get all matching items, make the following request:

POST /api/data/scroll
{
	"query": {query},
    "only": ["_id"],
    "sort_fields": [ { "field": "_doc", "ascending": true } ] 
}
  • query (string) - The text to search for - See the Full text search documentation for examples
  • only ([]string) - describes the fields that are to be included, if none are provided the entire document is returned
  • sort ([]{field: String, ascending: Bool) - a list of sorts to be applied to result. Sorts are applied in order they are given.

Scroll search response

A typical scroll search response looks like this:

{
{
  "total_hits": <number of results>,
  "results": [
    {
            "result": {
                "_id": "b44698697fc7de5725d1e1fe22d38e32",
                "last_modified": "2016-07-20T21:21:09Z",
                "location_id": "AVbdTJJcuT9aoTJxqbUD",
                "location_kind": "azure",
                "location_name": "Demo Content",
                "mime_type": "audio/x-wav",
                "name": "Annie and Brie/Raw Audio/AB3-1C_2561.wav",
                "stow_container_id": "annie-and-brie",
                "stow_container_name": "annie-and-brie",
                "stow_url": "azure://democontent.blob.core.windows.net/annie-and-brie/Annie%20and%20Brie/Raw%20Audio/AB3-1C_2561.wav",
                ... all item fields
            },
            "score": 0.93453264
        }
  ]
}

query repeat the input values that yielded the results. If the only fields are not provided then the results will return the entire item document, which can be prohibitively resource hungry. If you are working with larger datasets, it is advised to use the only fields to return just the fields that are of interest.

  • total_hits (int) Approximate number of total hits for the given search
  • results - (array) Array of result objects (see Result fields section below)
  • score - (int) A decimal percentage value of how relevant this item is to the search query (0 being not relevant, 1 being most relevant; low numbers are common)

Some examples for setting time ranges as a filter:

   "filters":{
      "ranges":[
         {
            "field":"last_harvested",
            "from":"now-1h",
            "to":""
         }
      ]

json "filters":{ "ranges":[ { "field":"last_harvested", "from":"2017-12-31T19:30:000.000Z", "to":"2017-12-31T19:45:00.000Z" } ]

Result fields

The result objects contain an overview of Item Object metadata.

  • _id - (string) Unique Item ID
  • last_modified - (timestamp) When the item was last modified
  • location_id - (string) The ID of the Location where this Item was found
  • location_kind - (string) The Location Kind (see the Location Kinds API for more information) of the Location where this Item was found
  • mime_type - (string) MIME type for the item
  • name - (string) Name of the item (usually filename)
  • stow_container_id - (string) Stow Container ID of where this Item was found
  • stow_container_name - (string) Name of the Stow Container where this Item was found
  • stow_url - (string) The Stow URL of this Item.

This documentation is generated from the latest version of GrayMeta Platform. For documentation relevant to your own deployed version, please use the documentation inside the application.