OMN Search API
The OMN Search REST API provides access to OMN’s search and result navigation functionality via a RESTful API.
OMN Search API usage guide
To access the OMN Search REST API you can use basically any programming language that has support for the HTTP protocol. You can even use command line tools like curl to process REST requests.
Here you will find an overview over the basic requests you need to perform searches in OMN.
- OMN Search API usage guide
- .1. Authentication
- .2. Version resource
- .3. Search resource
- .4. Suggest resource
- .5. Advanced Suggest resource
- .6. Stored search resource
- .6.1. Load list of stored searches of current user
- .6.2. Load list of stored searches of current user by index type
- .6.3. Load list of stored searches of current user by config id
- .6.4. Load a stored search by id
- .6.5. Store search for current user
- .6.6. Update stored search of current user
- .6.7. Rename stored search of current user
- .6.8. Delete stored search of current user
- .7. History resource
- .8. Index command resource
- .9. Fields resource
- .10. Configuration Options
.1. Authentication
The OMN Search REST API uses JSON Web Tokens (JWT) to secure the access. You have to provide a valid JWT in the authorization header to access the OMN Web REST API resources. To generate or debug JWTs you can use jwt.io.
curl -H 'Authorization: Bearer <JWT-TOKEN>' ...
.2. Version resource
The info resource provides version information about the OMN Search REST API. This is a simple starting point to test your REST requests.
Resource path |
/api/v1/search/version |
HTTP method |
GET |
Response type |
application/json |
curl -X GET -H 'Authorization: Bearer <JWT-TOKEN>' 'http://<OMN-ADDRESS>/api/v1/search/version'
{
"apiVersion": "{project-version}",
"processingTimeMillis": 0,
"majorVersion": "{parsedversion-majorversion}",
"minorVersion": "{parsedversion-minorversion}",
"patchVersion": "{parsedversion-buildnumber}",
"buildNumber": "{parsedversion-qualifier}"
}
.3. Search resource
OMN Search basically supports two search types: CONFIG-based searches and INDEX-based searches. The CONFIG-based searches match the search configurations of the OMN config client which define object type, result views, additional rules and data filters.
The INDEX-based searches perform searches directly in the index and do not apply any plugin backend configurations. They can be used, for example, to fetch data directly from the index.
Note: All field names that are passed as request parameters or returned in the response are in OMN expression format with dots (".") replaced by tildes ("~").
{
"name": "ISYImage~imageStorageInfo~heightInPixel",
"type": "long",
"value": 827
}
.3.1. Fulltext search
The fulltext search is the simplest form of searches. It searches the content of the "fulltext" index which contains a combination of several OMN attributes in one field.
.3.2. Fulltext search with backend configuration
Searches with backend configuration ("searchType": "CONFIG") rely on search configurations defined in OMN.
The value of the request parameter "configId" must be a valid ID of an "AdvancedSearch" or "FormBasedSearch" Page plugin.
Resource path |
/api/v1/search/search |
HTTP method |
POST |
Content type |
application/json |
Response type |
application/json |
{
"context": {
"searchType": "CONFIG",
"configId": 15567
},
"query": {
"queryType": "FULLTEXT",
"value": "jpg"
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"aggregationEnabled": true,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
}
]
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 544,
"resultCount": 6553,
"totalHitCount": 6553,
"exactHitCount": true,
"items": [
{
"id": 693000842,
"attributes": [
{
"name": "ISYImage~imageStorageInfo~heightInPixel",
"type": "long",
"value": 827
},
{
"name": "ISYObject~rootNodeConfiguration~pdfFirstPagePreviewOnly",
"type": "boolean",
"value": false
},
{
"name": "ISYImage~imageStorageInfo~colorspace",
"type": "string",
"value": "YCbCr/RGB"
},
{
"name": "ISYObject~rootNodeConfiguration~relativePath",
"type": "string",
"value": "MAM/"
},
{
"name": "ISYObject~rootNodeConfiguration~disablePreviewGeneration",
"type": "boolean",
"value": false
},
{
"name": "ISYObject~preview~thumbnail",
"type": "string",
"value": [
"62569466-8EE3-4ECE-862A-DFAF9F57522C"
]
},
{
"name": "ISYObject~rootNodeConfiguration~identity",
"type": "long",
"value": 24510
},
...
]
},
...
],
"facets": [
{
"name" : "ISYObject~isyObjectType",
"facets" : [
{
"facetType": "NAMED",
"attribute": "ISYObject~isyObjectType",
"label": "ISYObject~isyObjectType",
"type": "string",
"value": "IMG",
"from": null,
"to": null,
"count": 6553,
"children": null
}
]
},
{
"name": "ISYObject~online",
"facets": [
{
"facetType": "NAMED",
"attribute": "ISYObject~online",
"label": "ISYObject~online",
"type": "boolean",
"value": "true",
"from": null,
"to": null,
"count": 6553,
"children": null
}
]
}
]
}
Fulltext search with backend configuration and defined result attributes
The request parameter "resultAttributes" can be used to specify the OMN attributes which will be included in the response.
This will save processing time an will reduce the response size.
If the request parameter "resultAttributes" does not exist or is empty, all attributes are returned.
Resource path |
/api/v1/search/search |
HTTP method |
POST |
Content type |
application/json |
Response type |
application/json |
{
"context": {
"searchType": "CONFIG",
"configId": 15567
},
"query": {
"queryType": "FULLTEXT",
"value": "jpg"
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"aggregationEnabled": true,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
}
],
"resultAttributes": [
"ISYImage~imageStorageInfo~heightInPixel",
"ISYImage~imageStorageInfo~colorspace"]
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 337,
"resultCount": 6553,
"totalHitCount": 6553,
"exactHitCount": true,
"items": [
{
"id": 693000842,
"attributes": [
{
"name": "ISYImage~imageStorageInfo~heightInPixel",
"type": "long",
"value": 827
},
{
"name": "ISYImage~imageStorageInfo~colorspace",
"type": "string",
"value": "YCbCr/RGB"
},
{
"name": "id",
"type": "long",
"value": 693000842
}
]
},
{
"id": 692976759,
"attributes": [
{
"name": "ISYImage~imageStorageInfo~heightInPixel",
"type": "long",
"value": 281
},
{
"name": "ISYImage~imageStorageInfo~colorspace",
"type": "string",
"value": "YCbCr/RGB"
},
{
"name": "id",
"type": "long",
"value": 692976759
}
]
},
...
],
"facets": [
{
"name": "ISYObject~isyObjectType",
"facets": [
{
"facetType": "NAMED",
"attribute": "ISYObject~isyObjectType",
"label": "ISYObject~isyObjectType",
"type": "string",
"value": "IMG",
"from": null,
"to": null,
"count": 6553,
"children": null
}
]
},
{
"name": "ISYObject~online",
"facets": [
{
"facetType": "NAMED",
"attribute": "ISYObject~online",
"label": "ISYObject~online",
"type": "boolean",
"value": "true",
"from": null,
"to": null,
"count": 6553,
"children": null
}
]
}
]
}
Fulltext search without backend configuration
The search without backend configuration ("searchType": "INDEX") can be used to directly search in a specific index.
Resource path |
/api/v1/search/search |
HTTP method |
POST |
Content type |
application/json |
Response type |
application/json |
{
"context": {
"searchType": "INDEX",
"index": "ASSET"
},
"query": {
"queryType": "FULLTEXT",
"value": "jpg"
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"aggregationEnabled": true,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
}
]
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 242,
"resultCount": 6553,
"totalHitCount": 6553,
"exactHitCount": true,
"items": [
{
"id": 693000842,
"attributes": [
{
"name": "ISYImage~imageStorageInfo~heightInPixel",
"type": "long",
"value": 827
},
{
"name": "ISYObject~rootNodeConfiguration~pdfFirstPagePreviewOnly",
"type": "boolean",
"value": false
},
{
"name": "ISYImage~imageStorageInfo~colorspace",
"type": "string",
"value": "YCbCr/RGB"
},
{
"name": "ISYObject~rootNodeConfiguration~relativePath",
"type": "string",
"value": "MAM/"
},
{
"name": "ISYObject~rootNodeConfiguration~disablePreviewGeneration",
"type": "boolean",
"value": false
},
{
"name": "ISYObject~preview~thumbnail",
"type": "string",
"value": [
"62569466-8EE3-4ECE-862A-DFAF9F57522C"
]
},
{
"name": "ISYObject~rootNodeConfiguration~identity",
"type": "long",
"value": 24510
},
...
]
},
...
],
"facets": [
{
"name": "ISYObject~isyObjectType",
"facets": [
{
"facetType": "NAMED",
"attribute": "ISYObject~isyObjectType",
"label": "ISYObject~isyObjectType",
"type": "string",
"value": "IMG",
"from": null,
"to": null,
"count": 6553,
"children": null
}
]
},
{
"name": "ISYObject~online",
"facets": [
{
"facetType": "NAMED",
"attribute": "ISYObject~online",
"label": "ISYObject~online",
"type": "boolean",
"value": "true",
"from": null,
"to": null,
"count": 6553,
"children": null
}
]
}
]
}
.3.3. Fulltext search global
The global search performs a fulltext search in all indices, which are ASSET,CHANNEL and PRODUCT. Each of this indices share common fields:
| Field name | Meaning |
|---|---|
globalIndexType |
index |
globalObjectType |
object type |
globalName |
name |
globalIdentity |
identity |
globalCreationDate |
creation date |
globalModificationDate |
modification date |
| Preview | Expression | Supported index type |
|---|---|---|
THUMBNAIL |
globalPreview~thumbnail |
asset,product |
COARSE |
globalPreview~coarse |
asset,product |
Example:
Resource path |
/api/v1/search/search |
HTTP method |
POST |
Content type |
application/json |
Response type |
application/json |
{
"context": {
"searchType": "INDEX",
"index": "GLOBAL"
},
"query": {
"queryType": "FULLTEXT",
"value": "20160829"
},
"maxResults": 10,
"pageIndex": 1,
"pageSize": 10,
"aggregationEnabled": true,
"resultAttributes": [
"globalIndexType",
"globalObjectType",
"globalName",
"globalIdentity",
"globalCreationDate",
"globalModificationDate",
"globalPreview~thumbnail"
],
"sortOptions": [
{
"attribute": "globalCreationDate",
"direction": "ASC"
}
]
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 9,
"resultCount": 2,
"totalHitCount": 2,
"exactHitCount": true,
"items": [
{
"id": 23448300,
"attributes": [
{
"name": "globalName",
"type": "string",
"value": "20160829_203230.jpg"
},
{
"name": "globalIndexType",
"type": "string",
"value": "asset"
},
{
"name": "globalCreationDate",
"type": "date",
"value": "2019-07-02T11:31:39.485Z"
},
{
"name": "globalIdentity",
"type": "long",
"value": 23448300
},
{
"name": "globalModificationDate",
"type": "date",
"value": "2019-07-12T09:45:56.880Z"
},
{
"name": "id",
"type": "unknown",
"value": 23448300
},
{
"name": "globalObjectType",
"type": "string",
"value": "IMG"
},
{
"name": "globalPreview~thumbnail",
"type": "string",
"value": [
"FC9A1216-1E87-BB87-D3A0-5AC6A9F48B67"
]
}
]
},
{
"id": 23452040,
"attributes": [
{
"name": "globalName",
"type": "string",
"value": "20160829_082449.jpg"
},
{
"name": "globalIndexType",
"type": "string",
"value": "asset"
},
{
"name": "globalCreationDate",
"type": "date",
"value": "2019-07-12T11:46:59.226Z"
},
{
"name": "globalIdentity",
"type": "long",
"value": 23452040
},
{
"name": "globalModificationDate",
"type": "date",
"value": "2019-07-13T19:00:57.262Z"
},
{
"name": "id",
"type": "unknown",
"value": 23452040
},
{
"name": "globalObjectType",
"type": "string",
"value": "IMG"
},
{
"name": "globalPreview~thumbnail",
"type": "string",
"value": [
"1AFAF479-7165-EDD8-FD65-5F4A7E8DF11C"
]
}
]
}
],
"facets": [
{
"name": "globalIndexType",
"facets": [
{
"facetType": "NAMED",
"attribute": "globalIndexType",
"label": "globalIndexType",
"type": "string",
"value": "asset",
"count": 2,
"from": null,
"to": null,
"children": null
}
]
},
{
"name": "globalObjectType",
"facets": [
{
"facetType": "NAMED",
"attribute": "globalObjectType",
"label": "globalObjectType",
"type": "string",
"value": "IMG",
"count": 1287,
"from": null,
"to": null,
"children": null
}
]
}
]
}
.3.4. Combined search (e.g. facet search)
Combined searches ("queryType": "COMBINED") can be used to combine different queries. This is for example useful to implement
facet searches (drill down) in which the query entered by the user is combined with the selected facets. The example below shows
the combination of a fulltext query ("queryType": "FULLTEXT" - e.g. the user input) with a field query
("queryType": "FIELD" - e.g. a selected facet).
When executing facet searches the request parameter keyword=true must be passed for a "field query" for string values,
otherwise wrong results will occur for values containing separators (e.g. blanks, hyphens, etc.). For example the query string
"Baden-Württemberg" would also match on values "Baden" or "Württemberg" when the parameter keyword=true isn’t not passed.
When searching with the operators IS_EMPTY/IS_NOT_EMPTY, the value parameter is ignored and therefore does not have to be set.
When searching with the operators IN/NOT_IN or IS_EMPTY/IS_NOT_EMPTY, the keyword parameter is ignored and therefore does not have to be set.
Note: When executing a facet search the whole previous search query must always be combined with the facet query to prevent inconsistent results.
Resource path |
/api/v1/search/search |
HTTP method |
POST |
Content type |
application/json |
Response type |
application/json |
{
"context": {
"searchType": "CONFIG",
"configId": "15567"
},
"resultAttributes": [
"ISYObject~identity",
"ISYObject~name",
"ISYObject~isyObjectType",
"ISYObject~online",
"ISYObject~modificationDate",
...
],
"query": {
"queryType": "COMBINED",
"operator": "AND",
"queries": [
{
"queryType": "FULLTEXT",
"value": "web"
},
{
"queryType": "FIELD",
"name": "ISYObject~isyObjectType",
"comparator": "EQ",
"value": "IMG",
"keyword": "true"
}
]
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"aggregationEnabled": true,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
}
]
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 245,
"resultCount": 1025,
"totalHitCount": 1025,
"exactHitCount": true,
"items": [
{
"id": 693000842,
"attributes": [
{
"name": "ISYImage~imageStorageInfo~heightInPixel",
"type": "long",
"value": 827
},
{
"name": "ISYObject~rootNodeConfiguration~pdfFirstPagePreviewOnly",
"type": "boolean",
"value": false
},
{
"name": "ISYImage~imageStorageInfo~colorspace",
"type": "string",
"value": "YCbCr/RGB"
},
{
"name": "ISYObject~rootNodeConfiguration~relativePath",
"type": "string",
"value": "MAM/"
},
{
"name": "ISYObject~rootNodeConfiguration~disablePreviewGeneration",
"type": "boolean",
"value": false
},
{
"name": "ISYObject~preview~thumbnail",
"type": "string",
"value": [
"62569466-8EE3-4ECE-862A-DFAF9F57522C"
]
},
{
"name": "ISYObject~rootNodeConfiguration~identity",
"type": "long",
"value": 24510
},
...
]
},
...
],
],
"facets": [
{
"name": "ISYObject~isyObjectType",
"facets": [
{
"facetType": "NAMED",
"attribute": "ISYObject~isyObjectType",
"label": "ISYObject~isyObjectType",
"type": "string",
"value": "IMG",
"count": 1025,
"from": null,
"to": null,
"children": null
}
]
},
{
"name": "ISYObject~online",
"facets": [
{
"facetType": "NAMED",
"attribute": "ISYObject~online",
"label": "ISYObject~online",
"type": "boolean",
"value": "true",
"count": 1025,
"to": null,
"from": null,
"children": null
}
]
},
{
"name": "ISYObject~modificationDate",
"facets": [
{
"facetType": "RANGED",
"attribute": "ISYObject~modificationDate",
"label": "last-year",
"type": "date",
"value": "last-year",
"count": 384,
"from": "{year-ago-iso-8601}",
"to": null,
"children": null
}
]
}
}
}
| Parameter | Meaning |
|---|---|
aggregationEnabled |
Aggregation (facet search) enabled true or false (default: false) |
aggregationMaxResults |
Maximum number of requested aggregation results (default: 10) |
Complex combined searches
Combined searches can also be used to perform more complex searches, e.g. form-based searches or special searches. The query terms may also be nested.
| Operator |
|---|
AND |
OR |
| Comparator | Meaning |
|---|---|
EQ |
equals |
NOT_EQ |
not equals |
LIKE |
like |
NOT_LIKE |
not like |
GT |
greater than |
GE |
greater equals |
LT |
lower than |
LE |
lower equals |
TERM_STARTS_WITH |
starts with |
TERM_NOT_STARTS_WITH |
not starts with |
TERM_ENDS_WITH |
ends with |
TERM_NOT_ENDS_WITH |
not ends with |
TERM_WILDCARD |
wildcard ( |
IN |
in ("one of"), value must be an array |
NOT_IN |
not in ("not one of"), value must be an array |
IS_EMPTY |
is empty (value will be ignored) |
IS_NOT_EMPTY |
is not empty (value will be ignored) |
{
"context": {
"searchType": "CONFIG",
"configId": "22459895"
},
"query": {
"queryType": "COMBINED",
"operator": "AND",
"queries": [
{
"queryType": "FIELD",
"name": "ISYObject~isyObjectType",
"comparator": "EQ",
"value": "IMG"
},
{
"queryType": "FIELD",
"name": "ISYImage~imageStorageInfo~colorspace",
"comparator": "EQ",
"value": "RGB"
},
{
"queryType": "FIELD",
"name": "ISYImage~imageStorageInfo~heightInPixel",
"comparator": "GT",
"value": 1000
}
]
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"aggregationEnabled": true,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
}
]
}
{
"context": {
"searchType": "CONFIG",
"configId": "22459895"
},
"query": {
"queryType": "COMBINED",
"operator": "AND",
"queries": [
{
"queryType": "FIELD",
"name": "ISYObject~isyObjectType",
"comparator": "EQ",
"value": "IMG"
},
{
"queryType": "FIELD",
"name": "ISYImage~imageStorageInfo~colorspace",
"comparator": "EQ",
"value": "RGB"
},
{
"queryType": "COMBINED",
"operator": "OR",
"queries": [
{
"queryType": "FIELD",
"name": "ISYImage~imageStorageInfo~heightInPixel",
"comparator": "GT",
"value": 1000
},
{
"queryType": "FIELD",
"name": "ISYImage~imageStorageInfo~widthInPixel",
"comparator": "GT",
"value": 1000
}
]
}
]
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"aggregationEnabled": true,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
}
]
}
Field searches with comparator IN/NOT_IN
The IN comparator can be used to search over several values of a field within a single term. The value parameter has to be passed as an array.
| Comparator | Meaning |
|---|---|
IN |
in ("one of"), value must be an array |
NOT_IN |
not in ("not one of"), value must be an array |
{
"context": {
"searchType": "CONFIG",
"configId": "22459895"
},
"query": {
"queryType": "COMBINED",
"operator": "AND",
"queries": [
{
"queryType": "FULLTEXT",
"value": "jpg"
},
{
"queryType": "FIELD",
"name": "ISYObject~isyObjectType",
"comparator": "IN",
"value": [ "IMG", "FIL" ]
}
]
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"aggregationEnabled": true,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
}
]
}
{
"context": {
"searchType": "CONFIG",
"configId": "22459895"
},
"query": {
"queryType": "COMBINED",
"operator": "AND",
"queries": [
{
"queryType": "FULLTEXT",
"value": "jpg"
},
{
"queryType": "FIELD",
"name": "ISYObject~isyObjectType",
"comparator": "NOT_IN",
"value": ["IMG", "XYZ"]
}
]
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"aggregationEnabled": true,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
}
]
}
{
"context": {
"searchType": "CONFIG",
"configId": "22459895"
},
"query": {
"queryType": "COMBINED",
"operator": "AND",
"queries": [
{
"queryType": "FULLTEXT",
"value": "jpg"
},
{
"queryType": "FIELD",
"name": "id",
"comparator": "IN",
"value": [ 22390937, 23244732, 23324592 ]
}
]
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"aggregationEnabled": true,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
}
]
}
Field searches with comparator IS_EMPTY/IS_NOT_EMPTY
The IS_EMPTY comparator can be used to search for records where the given field is empty. The IS_NOT_EMPTY comparator can be used to search for records where the given field is NOT empty.
| Comparator | Meaning |
|---|---|
IS_EMPTY |
is empty (value will be ignored) |
IS_NOT_EMPTY |
is not empty (value will be ignored) |
{
"context": {
"searchType": "CONFIG",
"configId": "22459895"
},
"query": {
"queryType": "FIELD",
"comparator": "IS_EMPTY",
"name": "ISYObject~fileCreator~shortName"
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"aggregationEnabled": true,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
}
],
"resultAttributes": [
"id",
"ISYObject~fileCreator~shortName"]
}
{
"context": {
"searchType": "CONFIG",
"configId": "22459895"
},
"query": {
"queryType": "FIELD",
"comparator": "IS_NOT_EMPTY",
"name": "ISYObject~fileCreator~shortName"
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"aggregationEnabled": true,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
}
],
"resultAttributes": [
"id",
"ISYObject~fileCreator~shortName"]
}
.3.5. Sub-Searches (Join)
A sub-search(Join) is executed before the "main"-search. As a result field the sub-search must only return 1 attribute. The result is then combined with the main search (joinOn). A sub-search is similar to a SQL join/sub-select. Note that the number of sub-search result is limited to 65.000. If it is exceeded only the first 65.000 results from the sub-search are taken, so the main search may have to few results. Furthermore search option like pagination, max-result, sorting and aggregation are ignored for sub-searches.
{
"context": {
"searchType": "INDEX",
"index": "ASSET"
},
"query": {
"queryType": "FULLTEXT",
"value": ""
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 100,
"aggregationEnabled": true,
"resultAttributes": [
"ISYObject~name","ISYObject~identity"
],
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "ASC"
}
],
"join": {
"search": {
"context": {
"searchType": "INDEX",
"index": "CHANNEL"
},
"query": {
"queryType": "FULLTEXT",
"value": "0000101"
},
"resultAttributes": [
"identity"
]
},
"joinOn": "channels"
}
}
.3.6. Aggregations
An additional array ("aggregationAttributes") can be specified, to include aggretations(facets) in the search result.
Notice the attribtues(fields) must be aggregatable and ("aggregationEnabled") must be true
{
"context": {
"searchType": "INDEX",
"index": "ASSET"
},
"query": {
"queryType": "FULLTEXT",
"value": "test"
},
"maxResults": 10,
"pageIndex": 1,
"pageSize": 10,
"aggregationEnabled": true,
"resultAttributes" : ["ISYObject~name"],
"aggregationAttributes" : ["globalModificationDate", "globalIndexType", "globalObjectType"],
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "ASC"
}
]
}
Note: All attributes(fields) with type "ENUM","BOOLEAN" and "DATE" are default aggregatable. Others must be configured to be "aggregatable". See Configuration Options to get how to set "aggregatable" options.
.3.7. Pagination
For each search request the page size ("pageSize") and the page index ("pageIndex") must be passed.
The search result contains the meta data items ("items") of the requested page, the number of retrievable hits
("resultCount") and the total number of hits ("totalHitCount"). The number of pages can be calculated using the page
size and the number of retrievable hits.
The additional return value "exactHitCount" indicates whether the value of "totalHitCount" is exact or not: With "true" "totalHitCount" is the exact number of hits, with "false" the number of hits was only determined up to the value of "totalHitCount", but there are more hits.
To query another page of a search result the previous search request must be executed again with the page index changed.
Note: Since the pagination always performs a new search the search result may vary when switching pages.
{
"context": {
"searchType": "CONFIG",
"configId": 15567
},
"query": {
"queryType": "FULLTEXT",
"value": "jpg"
},
"maxResults": 10000,
"pageIndex": 2,
"pageSize": 10,
"aggregationEnabled": true,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
}
]
}
.3.8. Sorting
A search can be performed unsorted (empty or missing request parameter "sortOptions") or with one or more sort criteria.
The order of the sort criteria in the request parameter "sortOptions" defines their priority.
{
...,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
},
{
"attribute": "ISYObject~name",
"direction": "ASC"
}
]
}
| Modifier | direction |
|---|---|
ASC |
ascending |
DESC |
descending |
.3.9. Content language
The content language of multilingual fields can be addressed in a search request via the language parameter.
NOTE: At the moment only asset and product index support multilingual fields!
| Name | Description | Required |
|---|---|---|
language |
Content language (Format: <ISO-639-1 language code>_<ISO-3166-1 country code> e.g. "de_DE") |
Fulltext query returning multilingual fields
When the language parameter is provide in a search request the content of multilingual fields will only be returned in the language variant of the dedicated
content language.
{
"context": {
"searchType": "INDEX",
"index": "ASSET"
},
"query": {
"queryType": "FULLTEXT",
"value": "dilbert"
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"aggregationEnabled": true,
"language": "de_DE"
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 55,
"resultCount": 4,
"totalHitCount": 4,
"exactHitCount": true,
"items": [
{
"id": 23412813,
"attributes": [
{
"name": "globalName",
"type": "string",
"value": "dilbert_dreaming.gif"
},
...
{
"name": "ISYObject~metaDataAttributeValues~MASHA_LANG_DEP_ATTR",
"type": "string",
"value": "Masha deutsch"
},
...
]
},
...
],
"facets": []
}
When the language parameter is missing in the search request the content of multilingual fields is returned in every existing language variant. This results
in multiple occurrences of the multilingual field in the result attributes, each of them including the related content language as a field name suffix.
{
"apiVersion": "{project-version}",
"processingTimeMillis": 55,
"resultCount": 4,
"totalHitCount": 4,
"exactHitCount": true,
"items": [
{
"id": 23412813,
"attributes": [
{
"name": "globalName",
"type": "string",
"value": "dilbert_dreaming.gif"
},
...
{
"name": "ISYObject~metaDataAttributeValues~MASHA_LANG_DEP_ATTR.en_EN",
"type": "string",
"value": "Masha english"
},
{
"name": "ISYObject~metaDataAttributeValues~MASHA_LANG_DEP_ATTR.de_DE",
"type": "string",
"value": "Masha deutsch"
},
{
"name": "ISYObject~metaDataAttributeValues~MASHA_LANG_DEP_ATTR.fr_FR",
"type": "string",
"value": "Masha francais"
},
...
]
},
...
],
"facets": []
}
Field query on multilingual field
When querying the content of multilingual fields the language parameter has to be provided. Otherwise an empty result will be returned because there is no
default language.
{
"context": {
"searchType": "INDEX",
"index": "ASSET"
},
"query": {
"queryType": "FIELD",
"name": "ISYObject~metaDataAttributeValues~MASHA_LANG_DEP_ATTR",
"value": "deutsch"
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"aggregationEnabled": true,
"language": "de_DE"
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 30,
"resultCount": 4,
"totalHitCount": 4,
"exactHitCount": true,
"items": [
{
"id": 23412813,
"attributes": [
{
"name": "globalName",
"type": "string",
"value": "dilbert_dreaming.gif"
},
...
{
"name": "ISYObject~metaDataAttributeValues~MASHA_LANG_DEP_ATTR",
"type": "string",
"value": "Masha deutsch"
},
...
]
},
...
],
"facets": []
}
Aggregations on multilingual fields
Aggregations on multilingual fields will only include the language variant of the dedicated content language. If the language parameter is missing in the
search request an empty result will be returned for the multilingual field because there is no default language.
NOTE: This is still work in progress.
.4. Suggest resource
The suggest resource provides completion suggestions for user input which is useful for a search-as-you-type functionality. The client can send suggest requests for every key typed by the user and the suggest resource will return a list of possible completions of the user input.
Resource path |
/api/v1/search/suggest |
HTTP method |
POST |
Content type |
application/json |
Response type |
application/json |
| Name | Description | Required |
|---|---|---|
index |
Index type ( |
* |
text |
User input text (min length = 3) |
* |
count |
Number of suggestions (default = 10, max = 20) |
.4.1. Suggest terms for user input
{
"index": "ASSET",
"text": "tes"
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 17,
"suggestions": [
"/Test_ANA2/22980501templatePreview.png",
"/test7/assets/help/help_cz_CZ.csv",
"/test7/assets/help/help_de_AT.csv",
"/test7/assets/help/help_de_CH.csv",
"/test7/assets/help/help_de_DE.csv",
"/test7/assets/help/help_en_GB.csv",
"/test7/assets/help/help_en_IE.csv",
"/test7/assets/help/help_en_US.csv",
"/test7/assets/help/help_es_ES.csv",
"/test_ANA/22595740templatePreview.png"
]
}
.4.2. Suggest terms for user input with individual count
{
"index": "PRODUCT",
"text": "tes",
"count": 20
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 19,
"suggestions": [
"TEST_Artikel",
"TEST_DEF1",
"TEST_DEF2",
"TEST_DEF3",
"TEST_DEF4",
"TEST_DEF5",
"TEST_DEF6",
"TEST_DEF7",
"TEST_DEF8",
"TEST_Neu",
"TEST_Neu2",
"Test-2988",
"Test_Art",
"Test_Article_01",
"Test_Node_1",
"test",
"test art 6",
"test art1",
"test art7",
"test art_1"
]
}
.5. Advanced Suggest resource
In comparison with the suggest resource this advanced one provides more powerful completion suggestions for user input.
It supports the search from any position (e.g. from the middle) of the text and allows the distance between the search words. The results contain the html tag <em></em> to point out the position of the searched words in the text.
Resource path |
/api/v1/search/type-ahead |
HTTP method |
POST |
Content type |
application/json |
Response type |
application/json |
| Name | Description | Required |
|---|---|---|
index |
Index type ( |
* |
text |
User input text (min length = 3) |
* |
slop |
The distance between the searched words (default = 3) |
|
count |
Number of suggestions (default = 10) |
.5.1. Suggest terms for user input
{
"index": "ASSET",
"text": "this tes",
"count": 20,
"slop": 3
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 17,
"suggestions": [
"<em>this</em><em>tests</em>",
"<em>this</em> is a large <em>test</em>",
"<em>this</em> is <em>test1</em>",
"oh, <em>this</em> is not a <em>test2</em>"
],
"corrections": []
}
.5.2. Suggest corrections for user input
It can also provide the potential corrections if the searched words cannot be found. It is useful in case when the user has some spelling mistakes.
{
"index": "GLOBAL",
"text": "thet"
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 17,
"suggestions": [
],
"corrections": [
"test",
"text"
]
}
.6. Stored search resource
The resource provides functions for loading and saving search profiles ("stored searches").
.6.1. Load list of stored searches of current user
Loads a list of stored searches of the current user. The list entries contain the id, index type, and name of a saved search.
Example:
Resource path |
/api/v1/search/storedsearch |
HTTP method |
GET |
Content type |
application/json |
Response type |
application/json |
{
"apiVersion": "{project-version}",
"processingTimeMillis": 19,
"storedSearchEntries": [
{
"id": 1,
"index": "ASSET",
"name": "Find all jpg images"
},
{
"id": 2,
"index": "ASSET",
"name": "11.21.2019 17:02:40"
},
{
"id": 3,
"index": "PRODUCT",
"name": "11.21.2019 17:03:17"
},
{
"id": 4,
"index": "CHANNEL",
"name": "11.21.2019 17:03:51"
},
{
"id": 5,
"index": "GLOBAL",
"name": "Find all with state incomplete"
}
]
}
200 |
OK |
500 |
Internal server error |
.6.2. Load list of stored searches of current user by index type
Loads a list of stored searches of the current user by index type. The list entries contain the id, index type, and name of a saved search.
Example:
Resource path |
/api/v1/search/storedsearch |
HTTP method |
GET |
Parameter type |
URL parameter |
Response type |
application/json |
| Name | Description | Required |
|---|---|---|
index |
Index type ( |
(*) |
/api/v1/search/storedsearch?index=ASSET
{
"apiVersion": "{project-version}",
"processingTimeMillis": 19,
"storedSearchEntries": [
{
"id": 1,
"index": "ASSET",
"name": "Find all jpg images"
},
{
"id": 2,
"index": "ASSET",
"name": "11.21.2019 17:02:40"
}
]
}
200 |
OK |
500 |
Internal server error |
.6.3. Load list of stored searches of current user by config id
Loads a list of stored searches of the current user by plugin config id. The list entries contain the id, index type, and name of a saved search.
Example:
Resource path |
/api/v1/search/storedsearch |
HTTP method |
GET |
Parameter type |
URL parameter |
Response type |
application/json |
| Name | Description | Required |
|---|---|---|
configId |
Id of plugin backend configuration. If URL parameter is missing, all stored searches of the user are returned. |
(*) |
/api/v1/search/storedsearch?configId=22459895
{
"apiVersion": "{project-version}",
"processingTimeMillis": 19,
"storedSearchEntries": [
{
"id": 1,
"index": "ASSET",
"name": "Find all jpg images"
},
{
"id": 2,
"index": "ASSET",
"name": "11.21.2019 17:02:40"
}
]
}
200 |
OK |
500 |
Internal server error |
.6.4. Load a stored search by id
Loads a stored search by id. The returned search object can be used directly to execute the corresponding search.
Example:
Resource path |
/api/v1/search/storedsearch |
HTTP method |
GET |
Parameter |
Stored search ID |
Parameter type |
Path parameter |
Response type |
application/json |
/api/v1/search/storedsearch/1
{
"context": {
"searchType": "CONFIG",
"configId": 22459895
},
"query": {
"queryType": "FULLTEXT",
"value": "jpg"
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
}
],
"aggregationEnabled": true,
"aggregationMaxResults": 10,
"resultAttributes": [
"ISYImage~imageStorageInfo~heightInPixel",
"ISYImage~imageStorageInfo~colorspace"
]
}
200 |
OK |
404 |
Not found |
500 |
Internal server error |
.6.5. Store search for current user
Stores a search object for the current user.
Example:
Resource path |
/api/v1/search/storedsearch |
HTTP method |
POST |
Content type |
application/json |
Response type |
application/json |
| Name | Description | Required |
|---|---|---|
name |
Name of stored search. Note: Parameter is optional. If the parameter is missing or empty, the name is created automatically. |
|
searchObject |
Search object to be stored |
* |
{
"name": "My stored search",
"searchObject": {
"context": {
"searchType": "CONFIG",
"configId": 22459895
},
"query": {
"queryType": "FULLTEXT",
"value": "jpg"
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
}
],
"aggregationEnabled": true,
"aggregationMaxResults": 10,
"resultAttributes": [
"ISYImage~imageStorageInfo~heightInPixel",
"ISYImage~imageStorageInfo~colorspace"
]
}
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 40,
"id": 1,
"name": "My stored search"
}
201 |
Store search successfull |
500 |
Internal server error |
.6.6. Update stored search of current user
Updates a stored search of the current user.
Example:
Resource path |
/api/v1/search/storedsearch |
HTTP method |
PATCH |
Parameter |
Stored search ID |
Parameter type |
Path parameter |
Content type |
application/json |
Response type |
application/json |
| Name | Description | Required |
|---|---|---|
name |
Name of stored search. Note: Parameter is optional. If the parameter is missing or empty, the name is created automatically. |
|
searchObject |
Search object to be stored |
/api/v1/search/storedsearch/1
{
"name": "My stored search with a new name",
"searchObject": {
"context": {
"searchType": "CONFIG",
"configId": 22459895
},
"query": {
"queryType": "FULLTEXT",
"value": "jpg"
},
"maxResults": 10000,
"pageIndex": 1,
"pageSize": 10,
"sortOptions": [
{
"attribute": "ISYObject~modificationDate",
"direction": "DESC"
}
],
"aggregationEnabled": true,
"aggregationMaxResults": 10,
"resultAttributes": [
"ISYImage~imageStorageInfo~heightInPixel",
"ISYImage~imageStorageInfo~colorspace"
]
}
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 40,
"id": 1,
"name": "My stored search with a new name"
}
200 |
Update successfull |
404 |
Not found |
500 |
Internal server error |
.6.7. Rename stored search of current user
Renames a stored search of the current user.
"Rename" is the same operation as "Update", but without passing a search object.
Example:
Resource path |
/api/v1/search/storedsearch |
HTTP method |
PATCH |
Parameter |
Stored search ID |
Parameter type |
Path parameter |
Content type |
application/json |
Response type |
application/json |
| Name | Description | Required |
|---|---|---|
name |
Name of stored search. Note: Parameter is optional. If the parameter is missing or empty, the name is created automatically. |
/api/v1/search/storedsearch/1
{
"name": "My stored search with a new name"
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 40,
"id": 1,
"name": "My stored search with a new name"
}
200 |
Update successfull |
404 |
Not found |
500 |
Internal server error |
.6.8. Delete stored search of current user
Deletes a stored search of the current user.
Example:
Resource path |
/api/v1/search/storedsearch |
HTTP method |
DELETE |
Parameter |
Stored search ID |
Parameter type |
Path parameter |
Content type |
application/json |
Response type |
Empty response |
/api/v1/search/storedsearch/1
204 |
Delete successfull |
404 |
Not found |
500 |
Internal server error |
.7. History resource
The history resource provides all search histories of the user so that the user can reuse/rerun the old search easily.
All histories are stored in the search index HISTORY.
.7.1. Query the search history
Query the histories of the user under a certain context.
If no context is setted, all histories of the user will be returned. Otherwise only the histories of the given context
will be returned.
The results are sorted by the timestamp of the histories when they are added/updated.
Example:
Resource path |
/api/v1/search/history |
HTTP method |
GET |
Content type |
application/json |
Response type |
application/json |
| Name | Description | Required |
|---|---|---|
user |
The user whom the histories belong to |
* |
context |
The search context which depends on the concrete use cases. (default = ‘DEFAULT’) |
|
text |
The search text. If empty, it returns all histories of the current user. |
|
count |
Number of histories (default = 10) |
{
"user": "user",
"text": "sear",
"context": "context",
"count": 10
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 27,
"histories": [
"test <em>search3</em>",
"test <em>search2</em>",
"test <em>search1</em>"
]
}
.7.2. Add/Update the search history
Add a history into the search index.
The history will be stored under the context of the user. If no context is setted, it will be stored
under the DEFAULT context.
If the history with the same content exists already, then update its timestamp.
Example:
Resource path |
/api/v1/search/history |
HTTP method |
POST |
Content type |
application/json |
Response type |
application/json |
| Name | Description | Required |
|---|---|---|
user |
The user whom the current history belongs to |
* |
text |
The search history to be saved |
* |
context |
The search context which depends on the concrete use cases. (default = ‘DEFAULT’) |
{
"user": "user",
"text": "test search",
"context": "context"
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 27,
"added": {
"id": 10001,
"text": "test search",
"user": "user",
"context": "context"
}
}
.7.3. Delete the search history
Delete the histories of the user.
If the context are setted, it will delete all histories only under the given context.
Otherwise it will delete the histories under all contexts of the user.
The response will tell how many histories are deleted.
Example:
Resource path |
/api/v1/search/history |
HTTP method |
DELETE |
Content type |
application/json |
Response type |
application/json |
| Name | Description | Required |
|---|---|---|
user |
The user whom the to be deleted histories belong to |
* |
context |
The search context which depends on the concrete use cases. (default = ‘DEFAULT’) |
{
"user": "user",
"context": "context"
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 20,
"deleted": {
"user": "user",
"context": "context",
"count": 5
}
}
.8. Index command resource
The index command resource can be used to start an index rebuild or to query the state of a current index rebuild.
During an index rebuild, various events are processed:
PREPARE |
CREATE_INDEX |
ADD_DOCUMENTS |
SET_ALIAS |
PROCESS_DELTA |
DELETE_OLD_INDEX |
END |
ERROR |
.8.1. Start index rebuild
Starts the index rebuild of specified index.
Example:
Resource path |
/api/v1/search/index |
HTTP method |
POST |
Content type |
application/json |
Response type |
application/json |
{
"index": "PRODUCT",
"command": "REBUILD"
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 0,
"index": "PRODUCT",
"event": "CREATE_INDEX",
"documentsProcessed": 0,
"totalDocuments": 0,
"command": "REBUILD"
}
200 |
OK |
500 |
Internal server error |
.8.2. Query state of index rebuild
Queries the rebuild state of a specified index.
Example:
Resource path |
/api/v1/search/index |
HTTP method |
POST |
Content type |
application/json |
Response type |
application/json |
{
"index": "PRODUCT",
"command": "STATE"
}
{
"apiVersion": "{project-version}",
"processingTimeMillis": 0,
"index": "PRODUCT",
"event": "END",
"documentsProcessed": 5982,
"totalDocuments": 5982,
"command": "STATE"
}
200 |
OK |
500 |
Internal server error |
.8.3. Query states of all indizes
Queries the states of all indizes in one request. It will return both the mapping state and indexing state.
The mapping state shows whether the search index mapping is out of date and the creation date of the current mapping.
The indexing state shows whether the indexing/re-indexing process is still running. It has following 3 values.
BUSY |
The indexing/re-indexing process is still running. |
END |
The last indexing/re-indexing process is done. Currently there is no indexing process running. |
ERROR |
The last indexing/re-indexing process is done with error. Currently there is no indexing process running. |
Example:
Resource path |
/api/v1/search/index/state |
HTTP method |
GET |
Response type |
application/json |
[
{
"index": "PRODUCT",
"mappingState": {
"outdated": false,
"createdAt": "2021-09-29T16:29:17.312+02:00"
},
"indexingState": {
"state": "END",
"documentsProcessed": 3514,
"totalDocuments": 3514
}
},
{
"index": "ASSET",
"mappingState": {
"outdated": false,
"createdAt": "2021-09-29T15:38:59.569+02:00"
},
"indexingState": {
"state": "BUSY",
"documentsProcessed": 1500,
"totalDocuments": 8901
}
}
]
200 |
OK |
500 |
Internal server error |
.9. Fields resource
The field resource can be used to query all fields that are available for the different indices. Each field description
contains information if it is aggretable, sortable, multilingual etc. For queries based on this information either use
the ("fieldName") or the ("attrIdentifier")(partial OMN-Expression).
Resource path |
/api/v1/search/fields |
HTTP method |
GET |
Query |
indexType |
Response type |
application/json |
/api/v1/search/fields?indexType=PRODUCT
[
{
"fieldName": "WE_VKFAKTOR1",
"label": "WE_VKFAKTOR1",
"fieldType": "double",
"aggregatable": false,
"sortable": true,
"multilingual": false,
"attrIdentifier": "WE_VKFAKTOR1",
"nestedFields": null
},
{
"fieldName": "WE_VKFAKTOR2",
"label": "WE_VKFAKTOR2",
"fieldType": "double",
"aggregatable": false,
"sortable": true,
"multilingual": false,
"attrIdentifier": "WE_VKFAKTOR2",
"nestedFields": null
},
{
"fieldName": "WE_REST_ART_ABOGEEIGNET",
"label": "WE_REST_ART_ABOGEEIGNET",
"fieldType": "boolean",
"aggregatable": true,
"sortable": true,
"multilingual": false,
"attrIdentifier": "WE_REST_ART_ABOGEEIGNET",
"nestedFields": null
}
]
.10. Configuration Options
The search project could be configured and customized by setting the options in the file "elasticsearch.properties".
It supports following options:
| Name | Description |
|---|---|
es.index.asset.fields.aggregatable |
Aggregatable fields list in 'asset' index which are separated with ',' Field name must be the expression path in OMN. e.g. ISYVideo.videoStorageInfo.title,ISYVideo.videoStorageInfo.name |
es.index.channel.fields.aggregatable |
Aggregatable fields list in 'channel' index which are separated with ',' Field name must be same as which defined in elastic search channel index. e.g. Configuration~MAM_CONFIG_REMOVE_BG_API_KEY |
es.index.product.fields.aggregatable |
Aggregatable fields list in 'product' index which are separated with ',' Field name must be same as which defined in elastic search product index. e.g. STRING_SINGLE_DOMAIN_ANV_LAZY_5_10 |
es.omn.operator.like.tokenized |
Accept the boolean value and default value is 'true'. Make the backend rule of operator 'like' to work on the tokenized text or not. @Deprecated Because the database based search cannot do tokenization. |