Skip to content

Commit

Permalink
Merge branch 'main' into parallel-test-run
Browse files Browse the repository at this point in the history
Signed-off-by: bowenlan-amzn <bowenlan23@gmail.com>
  • Loading branch information
bowenlan-amzn authored Oct 3, 2023
2 parents 22e1ba2 + dd50b3e commit 596ceaa
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ class ManagedIndexCoordinator(
.source(
SearchSourceBuilder().query(
QueryBuilders.existsQuery(ISM_TEMPLATE_FIELD)
).size(MAX_HITS)
).size(MAX_HITS).seqNoAndPrimaryTerm(true)
)
.indices(INDEX_MANAGEMENT_INDEX)
.preference(Preference.PRIMARY_FIRST.type())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class TransportIndexPolicyAction @Inject constructor(
.source(
SearchSourceBuilder().query(
QueryBuilders.existsQuery(ISM_TEMPLATE_FIELD)
).size(MAX_HITS)
).size(MAX_HITS).seqNoAndPrimaryTerm(true)
)
.indices(IndexManagementPlugin.INDEX_MANAGEMENT_INDEX)
.preference(Preference.PRIMARY_FIRST.type())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class ManagedIndexCoordinatorIT : IndexStateManagementRestTestCase() {
assertEquals("Has incorrect policy_id", policyID, managedIndexConfig!!.policyID)
assertEquals("Has incorrect index", index, managedIndexConfig.index)
assertEquals("Has incorrect name", index, managedIndexConfig.name)
assertEquals("Has incorrect seq no", policy.seqNo, managedIndexConfig.policySeqNo)
assertEquals("Has incorrect primary term", policy.primaryTerm, managedIndexConfig.policyPrimaryTerm)
}
}

Expand Down
41 changes: 39 additions & 2 deletions worksheets/ism/delete.http
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,53 @@ Content-Type: application/json
}
],
"ism_template": {
"index_patterns": ["testdelete"],
"index_patterns": ["testdelete2"],
"priority": 100
}
}
}

### delete index
###
DELETE localhost:9200/_opendistro/_ism/policies/exampledelete

###
PUT http://localhost:9200/testdelete
Content-Type: application/json

###
DELETE http://localhost:9200/testdelete
Content-Type: application/json

### add policy api call
POST localhost:9200/_plugins/_ism/add/testdelete
Content-Type: application/json

{
"policy_id": "exampledelete"
}

### explain api call
GET localhost:9200/_plugins/_ism/explain/testdelete?validate_action=true
Accept: application/json

### get policy call
GET localhost:9200/.opendistro-ism-config/_doc/exampledelete

### get managed index call
GET localhost:9200/.opendistro-ism-config/_search
Content-Type: application/json

{
"seq_no_primary_term": true,
"query": {
"term": {
"managed_index.index": {
"value": "testdelete2"
}
}
}
}

###
PUT http://localhost:9200/testdelete2
Content-Type: application/json

0 comments on commit 596ceaa

Please sign in to comment.