Skip to content

Commit

Permalink
feat: add search actions for the models (#362)
Browse files Browse the repository at this point in the history
* feat: add search actions for the models

* test: add Bluetooth model to the cleanup list

* docs: remove extra commas
  • Loading branch information
Kuruyia authored Aug 23, 2024
1 parent c85363a commit 9990e57
Show file tree
Hide file tree
Showing 10 changed files with 533 additions and 36 deletions.
81 changes: 81 additions & 0 deletions doc/2/controllers/models/search-assets/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
code: true
type: page
title: searchAssets
description: Searches for asset models
---

# searchAssets

Searches for asset models.

---

## Query Syntax

### HTTP

```http
URL: http://kuzzle:7512/_/device-manager/models/assets/_search
Method: POST
```

### Other protocols

```js
{
"controller": "device-manager/models",
"action": "searchAssets",
"engineGroup": "<engineGroup>",
"body": {
"query": {
// ...
},
"sort": [
// ...
]
},

// optional:
"from": "<starting offset>",
"size": "<page size>"
}
```

---

## Arguments

- `engineGroup`: name of the engine group
- `from`: paginates search results by defining the offset from the first result you want to fetch. Usually used with the `size` argument
- `size`: set the maximum number of documents returned per result page

## Body properties

- `query`: the search query itself, using the [ElasticSearch Query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/query-dsl.html).
- `sort`: contains a list of fields, used to [sort search results](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/search-request-sort.html), in order of importance.

---

## Response

```js
{
"status": 200,
"error": null,
"controller": "device-manager/models",
"action": "searchAssets",
"requestId": "<unique request identifier>",
"result": {
"hits": [
{
"_id": "<assetModelId>",
"_source": {
// Asset model content
},
},
],
"total": 42
}
}
```
79 changes: 79 additions & 0 deletions doc/2/controllers/models/search-devices/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
code: true
type: page
title: searchDevices
description: Searches for device models
---

# searchDevices

Searches for device models.

---

## Query Syntax

### HTTP

```http
URL: http://kuzzle:7512/_/device-manager/models/devices/_search
Method: POST
```

### Other protocols

```js
{
"controller": "device-manager/models",
"action": "searchDevices",
"body": {
"query": {
// ...
},
"sort": [
// ...
]
},

// optional:
"from": "<starting offset>",
"size": "<page size>"
}
```

---

## Arguments

- `from`: paginates search results by defining the offset from the first result you want to fetch. Usually used with the `size` argument
- `size`: set the maximum number of documents returned per result page

## Body properties

- `query`: the search query itself, using the [ElasticSearch Query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/query-dsl.html).
- `sort`: contains a list of fields, used to [sort search results](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/search-request-sort.html), in order of importance.

---

## Response

```js
{
"status": 200,
"error": null,
"controller": "device-manager/models",
"action": "searchDevices",
"requestId": "<unique request identifier>",
"result": {
"hits": [
{
"_id": "<deviceModelId>",
"_source": {
// Device model content
},
},
],
"total": 42
}
}
```
79 changes: 79 additions & 0 deletions doc/2/controllers/models/search-measures/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
code: true
type: page
title: searchMeasures
description: Searches for measure models
---

# searchMeasures

Searches for measure models.

---

## Query Syntax

### HTTP

```http
URL: http://kuzzle:7512/_/device-manager/models/measures/_search
Method: POST
```

### Other protocols

```js
{
"controller": "device-manager/models",
"action": "searchMeasures",
"body": {
"query": {
// ...
},
"sort": [
// ...
]
},

// optional:
"from": "<starting offset>",
"size": "<page size>"
}
```

---

## Arguments

- `from`: paginates search results by defining the offset from the first result you want to fetch. Usually used with the `size` argument
- `size`: set the maximum number of documents returned per result page

## Body properties

- `query`: the search query itself, using the [ElasticSearch Query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/query-dsl.html).
- `sort`: contains a list of fields, used to [sort search results](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/search-request-sort.html), in order of importance.

---

## Response

```js
{
"status": 200,
"error": null,
"controller": "device-manager/models",
"action": "searchMeasures",
"requestId": "<unique request identifier>",
"result": {
"hits": [
{
"_id": "<measureModelId>",
"_source": {
// Measure model content
},
},
],
"total": 42
}
}
```
Loading

0 comments on commit 9990e57

Please sign in to comment.