The search controller. AdmiralCloud’s search is based on OpenSearch/ElasticSearch (ES). You can use ES query language (DSL). Some limitations might occur and some fields/properties might not be allowed to use or return unexpected results as we sanitize and enhance every search request to ensure security of the call.
If you want to create complex applications it is highly recommended to talk to our engineering team.
Default search
The default search parameters, like aggregations or searchableFields can be found using Misc Controller. The searchableFields are those the standard search uses.
Basic Search
Enable basic search to search in field “relevantWords”. Relevant words is a combined field from container_name and tags.
Customized search experience
You can customize the search experience on a customer or user base. You can define other aggregations (as long as they are members of the default aggregations set) and you can customize which fields you want to be searched and what boosting they should have.
See Customized search experience for an example
Examples for searches
Basic/Simple search
// search for the given search term in all default fields (usually container_name, container_description)
{
"searchTerm": "my search term",
}
Complex searches
In order to work with complex searches, it is highly recommended to make yourself familiar with OpenSearch/ElasticSearch query DSL.
// search for huset (swedish for house) but search only videos and boost hits in swedish by factor 100.
{
"size":30,
"languages":[
{
"lang":"sv",
"boost": 100
}
],
"searchTerm":"huset",
"query":{
"bool":{
"filter":[
{
"terms":{
"type":[
"video"
]
}
}
]
}
}
}
Special searches
// color search
{
"searchTerm":"55,66,204",
"field":"colorSearch",
"colorSearchParams":{
"diff_ab":20,
"diff_l":10
}
}
// geo search
{
"searchTerm":"47.49, 19.05, 10",
"field":"gps"
}
Caveats and important remarks
When using search with size and from, you might run into a situation where not all documents for the search or even duplicates (on the next page/batch) are returned. It you want to scroll through results, it is recommended to use scroll contexts instead of size and from.
Elasticsearch uses Lucene’s internal doc IDs as tie-breakers. These internal doc IDs can be completely different across replicas of the same data. When paging search hits, you might occasionally see that documents with the same sort values are not ordered consistently.
https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html
Reference
Search as you type
Search-as-you-type enables you to fetch already existing values for a given field (e.g. return existing artists for field meta_artists)
searchTerm | string |
field | string |
{
"searchTerm": "prince",
"field": "meta_artist"
}
Field | Type | Required | Description |
---|---|---|---|
field | string | ✗ | optional field to search in. Can be customized on per-user based. Only a set of available fields can be used – this list is also customer based. If not set, the search uses container_name, container_description, container_comment, … |
searchTerm | any | ✗ | searchTerm to use for this search |
Field | Type | Description |
---|---|---|
aggregations | object | Optional aggregrations – can vary based on customer settings and request parameters. |
hits | object | Object with search results |
└ total | integer | Time the search request took in ms |
└ max_score | integer | Time the search request took in ms |
└ hits | array | Time the search request took in ms |
└ _id | string | Document ID |
└ _score | float | Score for this document |
└ _source | object | The actual document – properties can vary! |
└ sort | array | Sort criteria used |
└ matched_queries | array | Matched queries – they give some insights on why the document is in the response |
took | integer | Time the search request took in ms |
Search
Search based on Open Search/ElasticSearch (ES). You can either use simple search with searchTerm and other parameters (except query) or use the ES query language with the query parameter to perform complex searches.
We are searching in uni language and in the user’s language. The latter has more relevance than uni.
Available fields for searchTerm/field search
Field | Type | Notes/Explanation |
---|---|---|
id | integer | id id of a specific mediacontainer |
links | string | contains the links of external pages related to a mediacontainer (e.g. find a publicarea by link, …) |
orientation | integer | orientation of media (image) – default 1, 8 > rotate clockwise, 3 > 180°, 6 > rotate counter-clockwise |
width | integer | width of the original media of the mediacontainer |
height | integer | height of the original media of the mediacontainer |
fps | float | fps of the original media of the mediacontainer |
colorSpace | string | colorSpace of the original media of the mediacontainer (RBG, CYMK, …) |
checksum | string | search for this checksum (to find duplicates). Use prefix v1 for classic md5 checksum (deprecated) and v2 for new checksum based on AC-FileHash |
Color Search
- searchTerm must be a comma-separated list of RGB values (55,66,204)
- Optional you can send colorSearchParams to set the range for the color search
- Use field “colorSearch”
GPS/Geo-Location search
- searchTerm must be a comma-separated list of lat, lng, search radius in km – 47.49, 19.05, 10 means search in a 10km radius around 47.49 lat and 19.05 lng
- Use field “gps”
Aggregations
Please note, that aggregations will be returned based on the user’s searchConfiguration. Aggregations for “meta_productionYearAndMonth” and “meta_productionYearAndDay” will only be returned if a appropriate range request is in bool.filter of the query.
Field | Type | Required | Description |
---|---|---|---|
aggregations | object | ✗ | TBE |
basicSearch | boolean | ✗ | If true, searchTerm is used with combined field relevantWords. |
colorSearchParams | object | ✗ | optional object for colorsearch |
└ diff_ab | integer | ✗ | ab range (HSL model) – between TBC AND TBC |
└ diff_l | integer | ✗ | l range (HSL model) – between TBC AND TBC |
controlGroupIds | array | ✗ | optional list of controlGroups to search in (defaults to users membergroups). Please use integers not strings in array. Support for strings will be removed shortly without announcement. |
controlGroupIdsAll | array | ✗ | optional list of controlGroups that every search result must have set. Please use integers not strings in array. Support for strings will be removed shortly without announcement. |
controlGroupIdsNot | array | ✗ | optional list of controlGroups to exclude from search results. Please use integers not strings in array. Support for strings will be removed shortly without announcement. |
controlGroups | array | ✗ | optional list of controlGroups to search in (defaults to users membergroups) Do not use controlGroups anymore. Please use controlGroupIds instead. This field will be removed shortly without announcement! |
duplicate | integer | boolean | ✗ | If set to an integer, duplicates for this mediacontainer (based on original media checksum) are searched. If set to true, all duplicates (based on original media checksum) are shown |
field | string | ✗ | optional field to search in. Can be customized on per-user based. Only a set of available fields can be used – this list is also customer based. If not set, the search uses container_name, container_description, container_comment, … |
flags | array | ✗ | optional list of flags to use for search. Requires AdminLevel 1+ if you want to use flag 1 |
from | integer | ✗ | optional from position of the search result (defaults to 0). Maximum value is 9000. range: 0 to 9000 |
languages | array | ✗ | languages to (additonally) search in. If not set, the user's uiLanguage is used. |
└ lang | string | ✗ | language in iso2 |
└ boost | float | ✗ | factor to boost the language – if not set, defaults to 1 |
links | object | ✗ | settings for links |
└ ignoreFlags | array | ✗ | By default links with flag 1 and 99 are ignored. If you want all links, sent and empty array. 012399 |
minScore | integer | ✗ | value to reduce number of hits (by relevance) – only active if searchTerm is used. Experimental |
noAggregation | boolean | ✗ | If true, no aggregations will be returned (will improve search performance!) |
operation | string | ✗ | Set to count if you only want the number of results, but not the actual search results. searchcount |
query | object | ✗ | ES search query |
scroll | string | ✓ | Scroll context length 10s30s1m |
scrollId | string | ✗ | Scroll context Id |
searchAfter | array | ✗ | Array for search after – TBE |
searchMode | string | ✗ | Currently only used for face search. If set to exact, only assigned faces are returned. exact |
searchTerm | any | ✗ | searchTerm to use for this search |
size | integer | ✗ | size of the search result (defaults to 50). Maximum size is 1000 Paginating with ES is not guaranteed to return all documents. There might also be duplicates in the result. See notes above. range: 0 to 1000 |
sort | array | ✗ | optional list of types to use for search. |
sourceFields | array | ✗ | array of fields you want in the search response |
types | array | ✗ | optional list of types to use for search. |
Field | Type | Description |
---|---|---|
aggregations | object | Optional aggregrations – can vary based on customer settings and request parameters. |
hits | object | Object with search results |
└ total | integer | Time the search request took in ms |
└ max_score | integer | Time the search request took in ms |
└ hits | array | Time the search request took in ms |
└ _id | string | Document ID |
└ _score | float | Score for this document |
└ _source | object | The actual document – properties can vary! |
└ sort | array | Sort criteria used |
└ matched_queries | array | Matched queries – they give some insights on why the document is in the response |
took | integer | Time the search request took in ms |
Search similar items
Fetch similar items based on a given mediaContainerId. Similarity can be using phash, checksum and objectDetection.
Field | Type | Required | Description |
---|---|---|---|
limit | integer | ✗ | Limit per type. Takes precedence over customer settings for types. |
limit | integer | ✗ | Limit per type. Takes precedence over customer settings for types. |
mediaContainerId | integer | ✗ | Id of the base mediaContainer |
threshold | float | ✗ | Threshold for similarity. Values below will be discarded. |
Field | Type | Description |
---|---|---|
doc | object | ES document details |
mediaContainerId | integer | id of a similar mediaContainer |
similarity | array | Similarity infos |
└ type | string | Type of similarity phashchecksumobjectDetection |
└ confidence | float | Confidence of the similarity |