Skip to content

Commit

Permalink
Add force-merge API supports primary_only parameter (#6664)
Browse files Browse the repository at this point in the history
* Force-merge API supports primary_only parameter

Signed-off-by: gaobinlong <[email protected]>

* Fix typo

Signed-off-by: gaobinlong <[email protected]>

* Fix typo

Signed-off-by: gaobinlong <[email protected]>

* Fix vale failure

Signed-off-by: gaobinlong <[email protected]>

* Refine the wording

Signed-off-by: gaobinlong <[email protected]>

* Update _api-reference/index-apis/force-merge.md

Co-authored-by: Nathan Bower <[email protected]>
Signed-off-by: Melissa Vagi <[email protected]>

---------

Signed-off-by: gaobinlong <[email protected]>
Signed-off-by: Melissa Vagi <[email protected]>
Co-authored-by: Melissa Vagi <[email protected]>
Co-authored-by: Nathan Bower <[email protected]>
  • Loading branch information
3 people authored Mar 21, 2024
1 parent c5df18a commit 1235990
Showing 1 changed file with 8 additions and 0 deletions.
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 set to `true`, then the merge operation is performed only on the primary shards of an index. This can be useful when you want to take a snapshot of the index after the merge is complete. Snapshots only copy segments from the primary shards. Merging the primary shards can reduce resource consumption. Default is `false`. |

#### 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: Force merge primary shards

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

#### Example response

```json
Expand Down

0 comments on commit 1235990

Please sign in to comment.