Metadata and Object search¶
The Metadata and Object search can be used to search and analyze big volumes of objects quickly via a highly scalable text search. The search accepts filter parameters such as object name, location, created date, size and tags. Filters can be combined using "and" and "or" conditions.
The search results can be sorted by any one of the filter parameters and limited to maximum number of records per result set. If there are more results available than the defined maximum, a searchNext property is returned in the response. This property specifies the search request, which returns the remaining the results. It is included in every subsequent response, until the end of the list.
Supported Operators¶
The search filter supports the following operators for different data types as shown in the table:
Data Type | Operators | Description |
---|---|---|
String | contains | - Searches for generic strings - Uses wildcard to search strings may impact performance |
eq | - Direct match and recommends for quick search - Wildcard characters are not allowed | |
startswith | - Matches the initial characters of the string - Uses a wildcard character at the end | |
Date | before | Searches before the specified date |
between | Searches between the search dates | |
after | Searches after the specified date | |
Integer | eq | Matches exactly |
gt | Searches for integers greater than the specified value | |
lt | Searches for integers less than the specified value | |
Array (tags) | in | Matches the string within a list of strings |
Get a list of metadata for an object - 'None' Operator¶
Request URL:
{{gatewayUrl}}/api/datalake/v3/objectMetadata?filter=%7B%0A%20%20%22none%22%3A%7B%0A%20%20%22name%22%3A%20%7B%0A%20%20%20%20%22contains%22%3A%20%22sensor%22%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D
Note
- Filter Request:
filter={ "none":{ "name": { "contains": "sensor" } }
- Filter request is URL encoded
Content-Type: application/json
Response Example:
{
"objectMetadata": [
{
"name": "test1sensor.csv",
"location": "Folder/test1sensor.csv",
"size": 15,
"created": "2018-10-01T09:21:36.559Z",
"updated": "2018-10-03T09:21:36.559Z",
"tags": [
"tag1",
"tag3"
],
"metadataURL": "https://gateway.eu1-int.mindsphere.io/api/v3/dlstorage/objectMetadata/Folder1/test1sensor.csv"
}
]
}
Get a list of metadata for an object - 'OR' Operator¶
Request URL:
{{gatewayUrl}}/api/datalake/v3/objectMetadata?filter=%7B%0A%20%20%22or%22%3A%20%20%7B%0A%20%20%20%20%22name%22%3A%20%7B%20%22contains%22%3A%20%22sensor%22%7D%2C%0A%20%20%20%20%22created%22%3A%20%7B%22after%22%3A%20%222018-10-24T11%3A42%3A53.983Z%22%7D%2C%0A%20%20%20%20%22size%22%3A%20%7B%20%22eq%22%3A37%7D%2C%0A%20%20%20%20%22tags%22%3A%7B%20%22in%22%3A%5B%22tag1%22%2C%22tag3%22%5D%7D%0A%20%20%7D%0A%7D&maxRecords=1
Note
- Filter Request:
filter={ "or": { "name": { "contains": "sensor"}, "created": {"after": "2018-10-24T11:42:53.983Z"}, "size": { "eq":37}, "tags":{ "in":["tag1","tag3"]} } }
- Filter request is URL encoded
Content-Type: application/json
Response Example:
{
"objectMetadata": [
{
"name": "test1sensor.csv",
"location": "Folder/test1sensor.csv",
"size": 15,
"created": "2018-10-01T09:21:36.559Z",
"updated": "2018-10-03T09:21:36.559Z",
"tags": [
"tag1",
"tag3"
],
"metadataURL": "https://gateway.eu1-int.mindsphere.io/api/v3/dlstorage/objectMetadata/Folder1/test1sensor.csv"
}
],
"sort": [
{
"field": "name",
"order": "ASC"
}
],
"searchnext": [
{
"field": "name",
"next": "test2sensor"
},
{
"field": "_id",
"next": "2222222"
}
]
}
Get a list of metadata for an object - 'AND' Operator¶
Request URL:
{{gatewayUrl}}/api/datalake/v3/objectMetadata?filter=%7B%0A%20%20%20%20%22and%22%3A%20%20%7B%0A%20%20%20%20%22name%22%3A%20%7B%20%22contains%22%3A%20%22sensor%22%7D%2C%0A%20%20%20%20%22created%22%3A%20%7B%22after%22%3A%20%222018-10-24T11%3A42%3A53.983Z%22%7D%2C%0A%20%20%20%20%22size%22%3A%20%7B%20%22eq%22%3A37%7D%2C%0A%20%20%20%20%22tags%22%3A%7B%20%22in%22%3A%5B%22tag1%22%2C%22tag3%22%5D%7D%0A%20%20%7D%0A%7D
Note
- Filter Request:
filter={ "and": { "name": { "contains": "sensor"}, "created": {"after": "2018-10-24T11:42:53.983Z"}, "size": { "eq":37}, "tags":{ "in":["tag1","tag3"]} } }
- Filter request is URL encoded
Content-Type: application/json
Response Example:
{
"objectMetadata": [
{
"name": "test1sensor.csv",
"location": "Folder/test1sensor.csv",
"size": 15,
"created": "2018-10-01T09:21:36.559Z",
"updated": "2018-10-03T09:21:36.559Z",
"tags": [
"tag1",
"tag3"
],
"metadataURL": "https://gateway.eu1-int.mindsphere.io/api/v3/dlstorage/objectMetadata/Folder1/test1sensor.csv"
}
]
}