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

Change Document controller m* routes returns & fix SDK functional tests #1476

Merged
merged 71 commits into from
Oct 10, 2019
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
c23d4f4
wip
Aschen Sep 19, 2019
3b596cb
merge ok
Aschen Sep 23, 2019
3b14d46
Fix deleteIndexes with empty array
Aschen Sep 23, 2019
1e35333
fix document controller mXX routes
Aschen Sep 23, 2019
f488d94
fix validation wrong format on save + add check
Aschen Sep 24, 2019
7cfc69a
wip
Aschen Sep 24, 2019
8261403
manifest
Aschen Sep 24, 2019
7da7bda
merge ok
Aschen Sep 24, 2019
119b775
use latest SDK + allow to switch protocol
Aschen Sep 24, 2019
e964838
update package.json
Aschen Sep 24, 2019
5908f33
add new feature with sdk
Aschen Sep 24, 2019
0c37a0b
fix search-users
Aschen Sep 24, 2019
ebbb0f3
return successes array
Aschen Sep 24, 2019
b86b0d4
update migration guide
Aschen Sep 24, 2019
619763d
auto-reviewé
Aschen Sep 24, 2019
d5ac3e2
merge ok
Aschen Sep 24, 2019
b88a4d6
nit
Aschen Sep 24, 2019
5b9632e
update sdk
Aschen Sep 25, 2019
20baca8
Merge branch 'fix-sdk-functionnal-tests' into functionnal-test-sdk
Aschen Sep 25, 2019
58fa72d
mGet and mDelete returns successes and error array
Aschen Sep 25, 2019
4b34cda
Merge branch 'fix-sdk-functionnal-tests' into functionnal-test-sdk
Aschen Sep 25, 2019
428969c
fix DocumentExtractor test
Aschen Sep 25, 2019
89bd5d1
please sonarqube
Aschen Sep 25, 2019
0cb4e59
lint
Aschen Sep 25, 2019
41a6fe7
Merge branch 'fix-sdk-functionnal-tests' into functionnal-test-sdk
Aschen Sep 25, 2019
3c4ab68
Add feature for not listing the hidden collection
Aschen Sep 25, 2019
8d05ed7
Update migration guide
Aschen Sep 25, 2019
b7e3315
fix mapping change error
Aschen Sep 25, 2019
3b2c4bd
update dynamic mapping for users
Aschen Sep 25, 2019
c9ead07
Merge branch 'fix-sdk-functionnal-tests' into functionnal-test-sdk
Aschen Sep 25, 2019
7e2ec82
add document source to bulk:import errors
Aschen Sep 27, 2019
1d09b8a
Merge branch 'fix-sdk-functionnal-tests' into functionnal-test-sdk
Aschen Sep 27, 2019
c21e4fe
Returns the document source when an bulk:import item fail
Aschen Sep 27, 2019
1a276e2
Add functional test for bulk:import
Aschen Sep 27, 2019
8a48ccc
Returns the document source when an bulk:import item fail
Aschen Sep 27, 2019
dbbedf1
Merge branch 'functionnal-test-sdk' into fix-sdk-functionnal-tests
Aschen Sep 27, 2019
f3bebad
Apply suggestions from code review
Aschen Sep 27, 2019
36a361c
wip throw error when try creating hidden collection
Aschen Sep 27, 2019
92fbcc3
merge ok
Aschen Sep 27, 2019
afc3c03
merge ok
Aschen Oct 1, 2019
8a24769
wip
Aschen Oct 1, 2019
740fa5d
fix test
Aschen Oct 1, 2019
463c90d
fix wrong cluster update
Aschen Oct 1, 2019
5eeae60
Apply suggestions from code review
Aschen Oct 1, 2019
14c8034
fix functional tests
Aschen Oct 1, 2019
d7a6272
Merge branch 'fix-sdk-functionnal-tests' of github.com:kuzzleio/kuzzl…
Aschen Oct 1, 2019
aecd8f2
fix lint
Aschen Oct 1, 2019
debf91e
fix tests
Aschen Oct 2, 2019
83024c4
merge ok
Aschen Oct 7, 2019
724f896
Update doc/2/api/controllers/document/search/index.md
Aschen Oct 7, 2019
c60638a
Add errors examples for m*
Aschen Oct 7, 2019
a2a5f6c
Merge branch 'fix-sdk-functionnal-tests' of github.com:kuzzleio/kuzzl…
Aschen Oct 7, 2019
0bba174
sonarqube
Aschen Oct 7, 2019
c1437d7
sonarqube
Aschen Oct 7, 2019
1cd3fb4
sonarqube
Aschen Oct 7, 2019
1004494
add package lock
Aschen Oct 7, 2019
9c3e4c0
Fix mget method
Aschen Oct 7, 2019
068ea7e
activate integration tests
Aschen Oct 7, 2019
b50c662
fix bin/start-kuzzle-server
Aschen Oct 8, 2019
7c6e6a2
fix redis for functionnal tests
Aschen Oct 8, 2019
7c4a125
[doc] refresh error codes documentation
scottinet Oct 9, 2019
010aad1
add functionnal tests for document m* routes
Aschen Oct 9, 2019
c4cf088
fix unit test
Aschen Oct 9, 2019
af652ef
Merge branch 'fix-sdk-functionnal-tests' of github.com:kuzzleio/kuzzl…
Aschen Oct 9, 2019
e84978c
fix functional tests running
Aschen Oct 9, 2019
029a8bb
Remove deprecated routes
Aschen Oct 9, 2019
8ed34f9
Fix bulk import routes + clean docker-compose
Aschen Oct 10, 2019
f7c2e4e
Fix functional test (but not for socketio)
Aschen Oct 10, 2019
09c73a0
fix lint
Aschen Oct 10, 2019
2c366da
update error code
Aschen Oct 10, 2019
bf98f50
disable functional tests
Aschen Oct 10, 2019
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
11 changes: 7 additions & 4 deletions .ci/test-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ services:
- redis
- elasticsearch
environment:
- kuzzle_services__db__client__host=http://elasticsearch:9200
- kuzzle_services__storageEngine__client__node=http://elasticsearch:9200
- kuzzle_services__storageEngine__commonMapping__dynamic=true
- kuzzle_services__storageEngine__internalIndex__collections__users__dynamic=true
- kuzzle_services__internalCache__node__host=redis
- kuzzle_services__memoryStorage__node__host=redis
- kuzzle_server__protocols__mqtt__enabled=true
- kuzzle_server__protocols__mqtt__developmentMode=false
- kuzzle_services__storageEngine__commonMapping__dynamic=true
- NODE_ENV=production
- DEBUG=
- CUCUMBER_EMBEDDED_HOST=localhost
Expand All @@ -37,9 +38,11 @@ services:
image: redis:${REDIS_VERSION:-5}

elasticsearch:
image: kuzzleio/elasticsearch:5.6.10
image: kuzzleio/elasticsearch:7.3.0
ulimits:
nofile: 65536
environment:
- cluster.name=kuzzle
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- node.name=alyx
- cluster.name=kuzzle
- discovery.type=single-node
11 changes: 7 additions & 4 deletions .ci/test-armhf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ services:
- redis
- elasticsearch
environment:
- kuzzle_services__db__client__host=http://elasticsearch:9200
- kuzzle_services__storageEngine__client__node=http://elasticsearch:9200
- kuzzle_services__storageEngine__commonMapping__dynamic=true
- kuzzle_services__storageEngine__internalIndex__collections__users__dynamic=true
- kuzzle_services__internalCache__node__host=redis
- kuzzle_services__memoryStorage__node__host=redis
- kuzzle_server__protocols__mqtt__enabled=true
- kuzzle_server__protocols__mqtt__developmentMode=false
- kuzzle_services__storageEngine__commonMapping__dynamic=true
- NODE_ENV=production
- DEBUG=
- CUCUMBER_EMBEDDED_HOST=localhost
Expand All @@ -37,9 +38,11 @@ services:
image: redis:${REDIS_VERSION:-5}

elasticsearch:
image: kuzzleio/elasticsearch:5.6.10
image: kuzzleio/elasticsearch:7.3.0
ulimits:
nofile: 65536
environment:
- cluster.name=kuzzle
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- node.name=alyx
- cluster.name=kuzzle
- discovery.type=single-node
13 changes: 7 additions & 6 deletions .ci/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ services:
- redis
- elasticsearch
environment:
- kuzzle_services__db__client__host=http://elasticsearch:9200
- kuzzle_services__internalCache__node__host=redis
- kuzzle_services__memoryStorage__node__host=redis
- kuzzle_services__storageEngine__client__node=http://elasticsearch:9200
- kuzzle_services__storageEngine__commonMapping__dynamic=true
- kuzzle_services__storageEngine__internalIndex__collections__users__dynamic=true
- kuzzle_server__protocols__mqtt__enabled=true
- kuzzle_server__protocols__mqtt__developmentMode=false
- kuzzle_services__storageEngine__commonMapping__dynamic=true
- NODE_ENV=production
- DEBUG=
- CUCUMBER_EMBEDDED_HOST=localhost
Expand All @@ -37,9 +36,11 @@ services:
image: redis:${REDIS_VERSION:-5}

elasticsearch:
image: kuzzleio/elasticsearch:5.6.10
image: kuzzleio/elasticsearch:7.3.0
ulimits:
nofile: 65536
environment:
- cluster.name=kuzzle
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- node.name=alyx
- cluster.name=kuzzle
- discovery.type=single-node
2 changes: 1 addition & 1 deletion .kuzzlerc.sample
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@
// - "false": Stores document and does not update the collection
// mapping (field are not indexed)
// - "strict": Rejects document
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.6/dynamic-mapping.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.3/dynamic-mapping.html
"storageEngine": {
"backend": "elasticsearch",
"aliases": ["storageEngine"],
Expand Down
2 changes: 2 additions & 0 deletions default.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,13 @@ module.exports = {
name: 'kuzzle',
collections: {
users: {
dynamic: 'false',
properties: {
profileIds: { type: 'keyword' }
}
},
profiles: {
dynamic: 'false',
properties: {
policies: {
properties: {
Expand Down
2 changes: 1 addition & 1 deletion doc/2/api/controllers/admin/load-mappings/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Apply mappings to the storage layer.
**Notes:**

* The mapping can contain any number of index and collection configurations.
* Field definitions follow the [Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/mapping.html) mapping format.
* Field definitions follow the [Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/mapping.html) mapping format.
* If an index or collection does not exist, it will be created automatically.
* Mappings are loaded sequentially, one index/collection pair at a time. If a failure occurs, Kuzzle immediately interrupts the sequence.

Expand Down
23 changes: 13 additions & 10 deletions doc/2/api/controllers/bulk/import/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Creates, updates or deletes large amounts of documents as fast as possible.

This route is faster than the `document:m*` routes family (e.g. [document:mCreate](/core/2/api/controllers/document/m-create)), but no real-time notifications will be generated, even if some of the documents in the import match subscription filters.

If some documents actions fail, the client will receive a [PartialError](/core/2/api/essentials/errors/handling#partialerror) error.

---

## Query Syntax
Expand Down Expand Up @@ -77,21 +75,25 @@ Body:

## Body properties

The body must contain a `bulkData` array, detailing the bulk operations to perform, following [ElasticSearch Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docs-bulk.html).
The body must contain a `bulkData` array, detailing the bulk operations to perform, following [ElasticSearch Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/docs-bulk.html).

---

## Response

Returns an object containing 2 properties:
- `items`: array containing the list of executed queries result, in the same order than in the query
- `errors`: boolean indicating if some error occured during the import
Returns an object containing 2 arrays: `successes` and `errors`

Each query result contains the following properties:
Each created, replaced or updated document is an object of the `successes` array.
Each item is an object containing the action name as key and the corresponding object contain the following properties:
- `_id`: document unique identifier
- `status`: HTTP status code for that query

Each errored action is an object of the `errors` array:
Each item is an object containing the action name as key and the corresponding object contain the following properties:
- `_id`: document unique identifier
- `status`: HTTP status code for that query
- `error`: (only if status >= `400`)
- `_source`: document body
- `error`:
- `type`: elasticsearch client error type
- `reason`: human readable error message

Expand All @@ -105,7 +107,7 @@ Each query result contains the following properties:
"action": "import",
"requestId": "<unique request identifier>",
"result": {
"items": [
"successes": [
{
"index": {
"_id": "hQ10_GwBB2Y5786Pu_NO",
Expand All @@ -130,7 +132,8 @@ Each query result contains the following properties:
"status": 201
}
}
]
],
"errors": []
}
}
```
25 changes: 13 additions & 12 deletions doc/2/api/controllers/bulk/m-write/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ title: mWrite

<SinceBadge version="1.8.0" />


Create or replace multiple documents directly into the storage engine.

This is a low level route intended to bypass Kuzzle actions on document creation, notably:
Expand Down Expand Up @@ -100,15 +99,19 @@ Body:

## Response

Returns a `hits` array, containing the list of created documents, in the same order than the one provided in the query.
Returns an object containing 2 arrays: `successes` and `errors`

Each created document is an object with the following properties:
Each created or replaced document is an object of the `successes` array with the following properties:

- `_id`: created document unique identifier
- `_id`: document unique identifier
- `_source`: document content
- `_version`: version number of the document
- `_version`: version of the document (should be `1`)

Each errored document is an object of the `errors` array with the following properties:

If one or more document creations fail, the response status is set to `206`, and the `error` object contains a [partial error](/core/2/api/essentials/errors/handling#partialerror) error.
- `document`: original document that caused the error
- `status`: HTTP error status code
- `reason`: human readable reason

### Example

Expand All @@ -122,25 +125,23 @@ If one or more document creations fail, the response status is set to `206`, and
"controller": "bulk",
"requestId": "<unique request identifier>",
"result": {
"hits": [
"successes": [
{
"_id": "<documentId>",
"_source": {
// document content
},
"_version": 2,
"created": false
"_version": 2
},
{
"_id": "<anotherDocumentId>",
"_source": {
// document content
},
"_version": 1,
"created": true
"_version": 1
}
],
"total": 2
"errors": []
}
}
```
48 changes: 19 additions & 29 deletions doc/2/api/controllers/collection/get-mapping/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,15 @@ Method: GET
Returns a mapping object with the following structure:

```
<index>
|- mappings
|- <collection>
|- dynamic
|- _meta
|- metadata 1
|- metadata 1
|- properties
|- mapping for field 1
|- mapping for field 2
|- ...
|- mapping for field n
|- dynamic
|- _meta
|- metadata 1
|- metadata 1
|- properties
|- mapping for field 1
|- mapping for field 2
|- ...
|- mapping for field n
```

### Example:
Expand All @@ -74,22 +71,16 @@ Returns a mapping object with the following structure:
"action": "getMapping",
"requestId": "<unique request identifier>",
"result": {
"<index>": {
"mappings": {
"<collection>": {
"dynamic": "true",
"_meta": {
"metadata1": "value1"
},
"properties": {
"field1": { "type": "integer" },
"field2": { "type": "keyword" },
"field3": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
}
}
}
"dynamic": "true",
"_meta": {
"metadata1": "value1"
},
"properties": {
"field1": { "type": "integer" },
"field2": { "type": "keyword" },
"field3": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
}
}
}
Expand All @@ -103,4 +94,3 @@ Returns a mapping object with the following structure:

- [Common errors](/core/2/api/essentials/errors/handling#common-errors)
- [NotFoundError](/core/2/api/essentials/errors/handling#notfounderror)

Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Body:
### Optional:

- `from` is usually used with the `size` argument, and defines the offset from the first result you want to fetch
- `scroll` is used to fetch large result sets, and it must be set with a [time duration](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/common-options.html#time-units). If set, a forward-only cursor will be created (and automatically destroyed at the end of the set duration), and its identifier will be returned in the `scrollId` property, along with the first page of the results. This cursor can then be moved forward using the [`scrollSpecifications` API action](/core/2/api/controllers/collection/scroll-specifications)
- `scroll` is used to fetch large result sets, and it must be set with a [time duration](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/common-options.html#time-units). If set, a forward-only cursor will be created (and automatically destroyed at the end of the set duration), and its identifier will be returned in the `scrollId` property, along with the first page of the results. This cursor can then be moved forward using the [`scrollSpecifications` API action](/core/2/api/controllers/collection/scroll-specifications)
- `size` controls the maximum number of documents returned in the response

---
Expand All @@ -68,7 +68,7 @@ Body:

### Optional:

- `query`: a search query filtering the result, using the [ElasticSearch Query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl.html)
- `query`: a search query filtering the result, using the [ElasticSearch Query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/query-dsl.html)

---

Expand Down
2 changes: 1 addition & 1 deletion doc/2/api/controllers/document/count/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Body:

### Optional:

- `query`: if provided, will count only documents matching this search query. Uses the [ElasticSearch Query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl.html) syntax.
- `query`: if provided, will count only documents matching this search query. Uses the [ElasticSearch Query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/query-dsl.html) syntax.

---

Expand Down
2 changes: 1 addition & 1 deletion doc/2/api/controllers/document/delete-by-query/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Body:

## Body properties

- `query`: documents matching this search query will be deleted. Uses the [ElasticSearch Query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl.html) syntax.
- `query`: documents matching this search query will be deleted. Uses the [ElasticSearch Query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/query-dsl.html) syntax.

---

Expand Down
Loading