Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kuzzleio/kuzzle
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: kuzzleio/kuzzle
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: refs/heads/feat/collection-settings-get-update
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 5 commits
  • 5 files changed
  • 2 contributors

Commits on Feb 5, 2025

  1. feat: collection getSettings

    thomas-mauran committed Feb 5, 2025
    Copy the full SHA
    1d494f6 View commit details
  2. chore: lint

    thomas-mauran committed Feb 5, 2025
    Copy the full SHA
    4be9136 View commit details
  3. test: fix the test

    thomas-mauran committed Feb 5, 2025
    Copy the full SHA
    2a9bbbe View commit details

Commits on Feb 13, 2025

  1. Update doc/2/api/controllers/collection/get-settings/index.md

    etrousset authored Feb 13, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    61c72d4 View commit details
  2. fix: getSettings redundant code

    thomas-mauran committed Feb 13, 2025
    Copy the full SHA
    efa64f8 View commit details
80 changes: 80 additions & 0 deletions doc/2/api/controllers/collection/get-settings/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
code: true
type: page
title: getSettings | API | Core
---

# getSettings

Retrieves the Elasticsearch index settings for the specified Kuzzle collection.

---

## Query Syntax

### HTTP

```http
URL: http://kuzzle:7512/<index>/<collection>/_settings
Method: GET
```

### Other protocols

```js
{
"index": "<index>",
"collection": "<collection>",
"controller": "collection",
"action": "getSettings",
}
```

---

## Arguments

- `collection`: collection name
- `index`: index name

---

## Response

Returns a setting object with the following structure:

```js
{
"status": 200,
"error": null,
"action": "getSettings",
"controller": "collection",
"collection": "<collection>",
"index": "<index>",
"headers": {},
"result": {
"routing": {
"allocation": {
"include": {
"_tier_preference": "data_content"
}
}
},
"number_of_shards": "1",
"provided_name": "&platform.config",
"creation_date": "1738682329397",
"number_of_replicas": "1",
"uuid": "aY0IBbKJSvuIrwqqYyKkUw",
"version": {
"created": "7160299"
}
},
}
```

---

## Possible errors

- [Common errors](/core/2/api/errors/types#common-errors)
- [NotFoundError](/core/2/api/errors/types#notfounderror)
13 changes: 13 additions & 0 deletions features/CollectionController.feature
Original file line number Diff line number Diff line change
@@ -69,6 +69,19 @@ Feature: Collection Controller
| createdAt | { "type": "date" } |
| updatedAt | { "type": "date" } |


# collection:getSettings =====================================================

Scenario: Get collection settings
Given an index "nyc-open-data"
And I "create" the collection "nyc-open-data":"green-taxi" with:
| mappings | { "dynamic": "strict", "properties": { "name": { "type": "keyword" } } } |
When I successfully execute the action "collection":"getSettings" with args:
| index | "nyc-open-data" |
| collection | "green-taxi" |
Then I should receive a result matching:
| number_of_shards | "1" |

# collection:delete ==========================================================

Scenario: Delete a collection
18 changes: 18 additions & 0 deletions lib/api/controllers/collectionController.js
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@ class CollectionController extends NativeController {
"deleteSpecifications",
"exists",
"getMapping",
"getSettings",
"getSpecifications",
"list",
"refresh",
@@ -97,6 +98,23 @@ class CollectionController extends NativeController {
return this._filterMappingResponse(mapping);
}

/**
* Get the collection settings
*
* @param {Request} request
* @returns {Promise.<Object>}
*/
async getSettings(request) {
const { index, collection } = request.getIndexAndCollection();

return this.ask(
"core:storage:public:collection:settings:get",
index,
collection,
{},
);
}

/**
* Get the collection validation specifications
*
6 changes: 6 additions & 0 deletions lib/api/httpRoutes.js
Original file line number Diff line number Diff line change
@@ -140,6 +140,12 @@ const routes = [
controller: "collection",
action: "getMapping",
},
{
verb: "get",
path: "/:index/:collection/_settings",
controller: "collection",
action: "getSettings",
},
{
verb: "get",
path: "/:index/:collection/_search",
1 change: 0 additions & 1 deletion test/api/controllers/collectionController.test.js
Original file line number Diff line number Diff line change
@@ -651,7 +651,6 @@ describe("Test: collection controller", () => {
index,
collection,
);

should(response).be.instanceof(Object);
should(response).match({
acknowledged: true,