This end-point provides the capability to search for Devices either using a human-readable query string or using an Elasticsearch full-fledged query format. It's the responsibility of the client to provide a valid Elasticsearch query. In the query string format, different attributes of Device can be combined using AND/OR operators in the query. In the Elasticsearch query format, Terms, Wildcard, Match etc. queries can be provided in addition to the aggregations and/or pagination/sort parameters. The search results can be restricted to specific account(s) by providing the accountId(s) in addition to the query.
Sample input request body containing query string, aggregations, accountId & hierLevel:
{ "search": { "queryString": "name:Device AND esn:123456789", "aggregations": "{"statuses": {"terms": {"field": "status"}}}", "accountId": 2, "hierLevel": "1" }}
Sample input request body containing full-fledged Elasticsearch query with aggregations, accountId & hierLevel:
{ "search": { "query": { "query": { "bool": { "must": [ { "wildcard": { "name": { "value": "Device" } } }, { "term": { "esn": 123456789 } } ] } }, "aggs": { "statuses": { "terms": { "field": "status" } } } }, "accountId": 2, "hierLevel": "1" }}
Note: This API is only supported for version >= 2.1
post https://qa.connect.calamp.com/connect/services/devices/smartsearch