Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

API Guideline - Stabilize Http Verbs #152

Merged
merged 1 commit into from
Jul 7, 2022
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
24 changes: 12 additions & 12 deletions open-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1159,10 +1159,10 @@ paths:
$ref: '#/components/responses/401'
'404':
description: Not Found
put:
patch:
operationId: indexes.update
summary: Update Index
description: Update an index. Add a primaryKey if it doesn't already exists yet.
description: Update an index. Specify a primaryKey if it doesn't already exists yet.
tags:
- Indexes
security:
Expand Down Expand Up @@ -1788,7 +1788,7 @@ paths:
$ref: '#/components/responses/401'
'404':
description: Not Found
post:
patch:
operationId: indexes.settings.update
summary: Update settings
description: |
Expand Down Expand Up @@ -1925,7 +1925,7 @@ paths:
$ref: '#/components/responses/401'
'404':
description: Not Found
post:
put:
operationId: indexes.settings.synonyms.update
summary: Update synonyms
description: |
Expand Down Expand Up @@ -1993,7 +1993,7 @@ paths:
$ref: '#/components/responses/401'
'404':
description: Not Found
post:
put:
operationId: indexes.settings.sortable-attributes.update
summary: Update sortable attributes
description: |
Expand Down Expand Up @@ -2068,7 +2068,7 @@ paths:
$ref: '#/components/responses/401'
'404':
description: Not Found
post:
put:
operationId: indexes.settings.stopWords.update
summary: Update stop-words
description: |
Expand Down Expand Up @@ -2136,7 +2136,7 @@ paths:
$ref: '#/components/responses/401'
'404':
description: Not Found
post:
put:
operationId: indexes.settings.rankingRules.update
summary: Update ranking rules
description: |
Expand Down Expand Up @@ -2214,7 +2214,7 @@ paths:
$ref: '#/components/responses/401'
'404':
description: Not Found
post:
patch:
operationId: indexes.settings.typoTolerance.update
summary: Update typo tolerance settings
description: |
Expand Down Expand Up @@ -2282,7 +2282,7 @@ paths:
$ref: '#/components/responses/401'
'404':
description: Not Found
post:
put:
operationId: indexes.settings.filterableAttributes.update
summary: Update Filterable Attributes
description: |
Expand Down Expand Up @@ -2351,7 +2351,7 @@ paths:
$ref: '#/components/responses/401'
'404':
description: Not Found
post:
put:
operationId: indexes.settings.distinctAttribute.update
summary: Update distinct attribute
description: |
Expand Down Expand Up @@ -2418,7 +2418,7 @@ paths:
$ref: '#/components/responses/401'
'404':
description: Not Found
post:
put:
operationId: indexes.settings.searchableAttributes.update
summary: Update searchable attributes
description: |
Expand Down Expand Up @@ -2484,7 +2484,7 @@ paths:
$ref: '#/components/responses/401'
'404':
description: Not Found
post:
put:
operationId: indexes.settings.displayedAttributes.update
summary: Update displayed attributes
description: |
Expand Down
3 changes: 1 addition & 2 deletions text/0117-typo-tolerance-setting-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ All properties must be returned when the resource is retrieved.

- 🔴 If the index does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.

#### 3.2.2.2. `POST` - `indexes/:index_uid/settings/typo-tolerance`
#### 3.2.2.2. `PATCH` - `indexes/:index_uid/settings/typo-tolerance`

Allow customizing partially the settings of the typo tolerance feature for an index.

Expand Down Expand Up @@ -292,5 +292,4 @@ The `typo` ranking rule favors candidates with the least typos. That is, if a do
- Expose `typoTolerance` resource as a search parameter to override index settings.
- Add the possibility to disable the typo tolerance feature on all numeric fields.
- Add different modes of result matching for the typo feature. e.g. `default`/`min`/`strict`
- Replace `POST` to `PATCH` verb to allow partial edit of the settings and embrace REST API convention.
- Introduce synchronous `invalid_typo_tolerance_{fieldName}` error with a better error message than the one provided by serde.
5 changes: 2 additions & 3 deletions text/0123-displayed-attributes-setting-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Therefore, if a document field is not in the `displayedAttributes` list, the fie

Suppose a database of movies with the following fields: `id`, `overview`, `genres`, `title`, `release_date`. Some of these fields are more useful to be displayed than others. To make the `id` and `genres` fields non-displayed, it can be specified in the following way.

***Request payload `POST`- `/indexes/movies/settings/displayed-attributes`***
***Request payload `PUT`- `/indexes/movies/settings/displayed-attributes`***
```json
["title", "overview"]
```
Expand Down Expand Up @@ -51,7 +51,7 @@ Fetch the `displayedAttributes` setting of a Meilisearch index.

- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.

#### 3.3.2. `POST` - `indexes/:index_uid/settings/displayed-attributes`
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/displayed-attributes`

Modify the `displayedAttributes` setting of a Meilisearch index.

Expand Down Expand Up @@ -122,6 +122,5 @@ N/A

## 5. Future Possibilities

- Replace `POST` HTTP verb with `PATCH`
- Add dedicated error to avoid using generic `bad_request` error code
- Return an error when `displayedAttributes` is defined as an empty array
3 changes: 1 addition & 2 deletions text/0123-distinct-attribute-setting-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Fetch the `distinctAttribute` setting of a Meilisearch index.

- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.

#### 3.3.2. `POST` - `indexes/:index_uid/settings/distinct-attribute`
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/distinct-attribute`

Modify the `distinctAttribute` setting of a Meilisearch index.

Expand Down Expand Up @@ -169,6 +169,5 @@ Modifying this index setting cause documents to be re-indexed.

## 5. Future Possibilities

- Replace `POST` HTTP verb with `PATCH`
- Add dedicated error to avoid using generic `bad_request` error code
- Return an error when `distinctAttribute` is specified as an empty string
3 changes: 1 addition & 2 deletions text/0123-filterable-attributes-setting-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Fetch the `filterableAttributes` setting of a Meilisearch index.

- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.

#### 3.3.2. `POST` - `indexes/:index_uid/settings/filterable-attributes`
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/filterable-attributes`

Modify the `filterableAttributes` setting of a Meilisearch index.

Expand Down Expand Up @@ -116,5 +116,4 @@ Modifying this index setting cause documents to be re-indexed.

## 5. Future Possibilities

- Replace `POST` HTTP verb with `PATCH`
- Add dedicated error to avoid using generic `bad_request` error code
5 changes: 2 additions & 3 deletions text/0123-ranking-rules-setting-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Suppose a movie dataset. The documents contain a field `release_date` with a tim

The following example creates a custom ranking rule that makes recent movies more relevant than older ones. A movie released in 2020 will appear before a movie released in 1999.

***Request payload `POST`- `/indexes/products/settings/ranking-rules`***
***Request payload `PUT`- `/indexes/products/settings/ranking-rules`***
```json
[
"words",
Expand Down Expand Up @@ -123,7 +123,7 @@ Fetch the `rankingRules` setting of a Meilisearch index.

- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.

#### 3.3.2. `POST` - `indexes/:index_uid/settings/ranking-rules`
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/ranking-rules`

Modify the `rankingRules` setting of a Meilisearch index.

Expand Down Expand Up @@ -201,6 +201,5 @@ The first ranking rule is applied to all documents, while each subsequent rule i

## 5. Future Possibilities

- Replace `POST` HTTP verb with `PATCH`
- Add dedicated error to avoid using generic `bad_request` error code
- Return an error when `rankingRules` is defined as an empty array
18 changes: 8 additions & 10 deletions text/0123-searchable-attributes-setting-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ By default, Meilisearch looks for matches in every field, but the `searchableAtt

Suppose a database of movies with the following fields: `id`, `overview`, `genres`, `title`, `release_date`. These fields all contain useful information; however, some are more useful to search than others. To make the `id` and `release_date` fields non-searchable and re-order the remaining fields by importance, it can be specified in the following way.

***Request payload `POST`- `/indexes/movies/settings/searchable-attributes`***
***Request payload `PUT`- `/indexes/movies/settings/searchable-attributes`***
```json
["overview", "genres", "title"]
```
Expand Down Expand Up @@ -49,7 +49,7 @@ This default behavior is indicated by a `searchableAttributes` value of `["*"]`.

To make some attributes non-searchable, or change the attribute ranking order. Attributes must be described from most important to least important.

***Request payload `POST`- `/indexes/movies/settings/searchable-attributes`***
***Request payload `PUT`- `/indexes/movies/settings/searchable-attributes`***
```json
["title", "overview", "genres"]
```
Expand All @@ -64,12 +64,11 @@ Manually updating `searchableAttributes` will change the displayed order of docu

A document field that is not defined in the list of `searchableAttributes` will not be considered by the following ranking rules to match and rank search results.

- [Words]()
- [Typo]()
- [Proximity]()
- [Attribute]()
- [Exactness](0036-exactness-criterion.md)

1. [Words](0123-settings-api.md#3111-words-ranking-rule)
2. [Typo](0123-settings-api.md#3112-typo-ranking-rule)
3. [Proximity](0123-settings-api.md#3113-proximity-ranking-rule)
4. [Attribute](0123-settings-api.md#3114-attribute-ranking-rule)
6. [Exactness](0123-settings-api.md#3116-exactness-ranking-rule)

### 3.2. Global Settings API Endpoints Definition

Expand All @@ -94,7 +93,7 @@ Fetch the `searchableAttributes` setting of a Meilisearch index.

- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.

#### 3.3.2. `POST` - `indexes/:index_uid/settings/searchable-attributes`
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/searchable-attributes`

Modify the `searchableAttributes` setting of a Meilisearch index.

Expand Down Expand Up @@ -170,7 +169,6 @@ Modifying this index setting cause documents to be re-indexed.

## 5. Future Possibilities

- Replace `POST` HTTP verb with `PATCH`
- Add dedicated error to avoid using generic `bad_request` error code
- Return an error when `searchableAttributes` is defined as an empty array
- Fix the reordering issue of document representation when `searchableAttributes` is specified.
6 changes: 3 additions & 3 deletions text/0123-settings-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ N/A
| [stop-words](0123-stop-words-setting-api.md) | `stopWords` sub-resource API endpoints definition |
| [synonyms](0123-synonyms-setting-api.md) | `synonyms` sub-resource API endpoints definition |
| [distinct-attribute](0123-distinct-attribute-setting-api.md) | `distinctAttribute` sub-resource API endpoints definition |
| [typo-tolerance](0117-typo-tolerance-setting-api.md) | `typoTolerance` sub-resource API endpoints definition |
| [typo-tolerance](0117-typo-tolerance-setting-api.md) | `typoTolerance` sub-resource API endpoints definition |

Each setting is exposed as a sub-resource of the `indexes/:index_uid/settings` endpoints. e.g. The ranking rules setting of a Meilisearch index is exposed at `indexes/:index_uid/settings/ranking-rules`.

Expand Down Expand Up @@ -55,7 +55,7 @@ The attributes ordering in the response payload is equivalent to the order descr

- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.

#### 3.2.2. `POST` - `indexes/:index_uid/settings`
#### 3.2.2. `PATCH` - `indexes/:index_uid/settings`

Modify the settings of a Meilisearch index.

Expand Down Expand Up @@ -148,4 +148,4 @@ Changing any of the following index settings will cause documents to be re-index

## 5. Future Possibilities

- Replace `POST` HTTP verb with `PATCH`
n/a
3 changes: 1 addition & 2 deletions text/0123-sortable-attributes-setting-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Fetch the `sortableAttributes` setting of a Meilisearch index.

- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.

#### 3.3.2. `POST` - `indexes/:index_uid/settings/sortable-attributes`
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/sortable-attributes`

Modify the `sortableAttributes` setting of a Meilisearch index.

Expand Down Expand Up @@ -116,5 +116,4 @@ Modifying this index setting cause documents to be re-indexed.

## 5. Future Possibilities

- Replace `POST` HTTP verb with `PATCH`
- Add dedicated error to avoid using generic `bad_request` error code
5 changes: 2 additions & 3 deletions text/0123-stop-words-setting-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The `stopWords` index setting allows the configuration of a list of words to be

Suppose a database contains articles written in English. Countless occurrences of `the` and `of` could deteriorate the relevancy of search results. To set `the` and `of` words as stop words, it can be specified the following way.

***Request payload `POST`- `/indexes/articles/settings/stop-words`***
***Request payload `PUT`- `/indexes/articles/settings/stop-words`***
```json
["the", "of"]
```
Expand Down Expand Up @@ -47,7 +47,7 @@ Fetch the `stopWords` setting of a Meilisearch index.

- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.

#### 3.3.2. `POST` - `indexes/:index_uid/settings/stop-words`
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/stop-words`

Modify the `stopWords` setting of a Meilisearch index.

Expand Down Expand Up @@ -119,5 +119,4 @@ Modifying this index setting cause documents to be re-indexed.

## 5. Future Possibilities

- Replace `POST` HTTP verb with `PATCH`
- Add dedicated error to avoid using generic `bad_request` error code
7 changes: 3 additions & 4 deletions text/0123-synonyms-setting-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Meilisearch supports two types of synonym declarations.

One-way association permits to declare one word to be synonymous with another, but not the other way around.

***Request payload `POST`- `/indexes/proucts/settings/synonyms`***
***Request payload `PUT`- `/indexes/proucts/settings/synonyms`***
```json
{
"phone": [
Expand All @@ -43,7 +43,7 @@ However, in the case of a search for `iphone`, documents containing `phone` will

By associating one or more synonyms with each other, they will be considered the same in both directions.

***Request payload `POST`- `/indexes/proucts/settings/synonyms`***
***Request payload `PUT`- `/indexes/proucts/settings/synonyms`***
```json
{
"shoe": [
Expand Down Expand Up @@ -94,7 +94,7 @@ Fetch the `synonyms` setting of a Meilisearch index.

- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.

#### 3.3.2. `POST` - `indexes/:index_uid/settings/synonyms`
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/synonyms`

Modify the `synonyms` setting of a Meilisearch index.

Expand Down Expand Up @@ -213,6 +213,5 @@ For example, although `League of Legends` and `LOL` can be synonymous, it will n

## 5. Future Possibilities

- Replace `POST` HTTP verb with `PATCH`
- Add dedicated error to avoid using generic `bad_request` error code
- Automatically declare mutual association
4 changes: 2 additions & 2 deletions text/0132-indexes-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Manipulate indexes of a Meilisearch instance.
- [3.2.1. `GET` - `indexes`](#321-get---indexes)
- [3.2.2. `GET` - `indexes/:index_uid`](#322-get---indexesindexuid)
- [3.2.3. `POST` - `indexes`](#323-post---indexes)
- [3.2.4. `PUT` - `indexes/:index_uid`](#324-put---indexesindexuid)
- [3.2.4. `PATCH` - `indexes/:index_uid`](#324-patch---indexesindexuid)
- [3.2.5. `DELETE` - `indexes/:index_uid`](#325-delete---indexesindexuid)

#### 3.2.1. `GET` - `indexes`
Expand Down Expand Up @@ -205,7 +205,7 @@ See [Summarized `task` Object for `202 Accepted`](0060-tasks-api.md#summarized-t
- 🔴 When Meilisearch is secured by a master key, if the API Key used do not have the `indexes.create` action defined, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error in the related asynchronous `task` resource. See [3.2.2.2. Response Definition](#3222-response-definition).
- 🔴 Sending a `uid` that already exists returns an [index_already_exists](0061-error-format-and-definitions.md#index_already_exists) error.

#### 3.2.4. `PUT` - `indexes/:index_uid`
#### 3.2.4. `PATCH` - `indexes/:index_uid`

Updates an index.

Expand Down