Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add search actions for the models #362

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading