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

Add force-merge API supports primary_only parameter #6664

Merged
merged 9 commits into from
Mar 21, 2024
8 changes: 8 additions & 0 deletions _api-reference/index-apis/force-merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ The following table lists the available query parameters. All query parameters a
| `ignore_unavailable` | Boolean | If `true`, OpenSearch ignores missing or closed indexes. If `false`, OpenSearch returns an error if the force merge operation encounters missing or closed indexes. Default is `false`. |
| `max_num_segments` | Integer | The number of larger segments into which smaller segments are merged. Set this parameter to `1` to merge all segments into one segment. The default behavior is to perform the merge as necessary. |
| `only_expunge_deletes` | Boolean | If `true`, the merge operation only expunges segments containing a certain percentage of deleted documents. The percentage is 10% by default and is configurable in the `index.merge.policy.expunge_deletes_allowed` setting. Prior to OpenSearch 2.12, `only_expunge_deletes` ignored the `index.merge.policy.max_merged_segment` setting. Starting with OpenSearch 2.12, using `only_expunge_deletes` does not produce segments larger than `index.merge.policy.max_merged_segment` (by default, 5 GB). For more information, see [Deleted documents](#deleted-documents). Default is `false`. |
| `primary_only` | Boolean | If `true`, the merge operation only performs on the primary shards, this is useful when you want to take snapshot for the specified indexes(snapshot only copies segments from the primary shards) after the merge operation completes, performing the merge operation only on primary shards can reduce the resources consumption. Default is `false`. |
gaobinlong marked this conversation as resolved.
Show resolved Hide resolved

#### Example request: Force merge a specific index

Expand Down Expand Up @@ -101,6 +102,13 @@ POST /.testindex-logs/_forcemerge?max_num_segments=1
```
{% include copy-curl.html %}

#### Example request: Perform force merge operation only on the primary shards of a index
gaobinlong marked this conversation as resolved.
Show resolved Hide resolved

```json
POST /.testindex-logs/_forcemerge?primary_only=true
```
{% include copy-curl.html %}

#### Example response

```json
Expand Down
Loading