CompareDomainConfiguration
Compares the metadata of two domains and reports where they differ. Use this operation to check that a secondary domain is configured consistently with its primary before you rely on it, because replication copies index data but does not copy domain metadata such as index templates, ingest pipelines, or security roles.
You choose which categories to compare. The response reports, for each category, how many items match, how many exist on only one domain, and which fields diverge.
Request Syntax
POST /2021-01-01/opensearch/compareDomainConfiguration HTTP/1.1
Content-type: application/json
{
"Categories": [ "string" ],
"SourceDomainArn": "string",
"TargetDomainArn": "string"
}
URI Request Parameters
The request does not use any URI parameters.
Request Body
The request accepts the following data in JSON format.
- Categories
-
The metadata categories to compare. At least one is required, and only the categories you name are read and returned.
-
aliases -
alerting_monitors -
cluster_settings -
component_templates -
ingest_pipelines -
ism_policies— index state management policies -
security_action_groups -
security_internal_users -
security_role_mappings -
security_roles -
templates— index templates
The set of categories grows over time, so this list is not fixed. A category the service does not recognise is rejected with the supported categories named in the error message.
Type: Array of strings
Array Members: Minimum number of 1 item. Maximum number of 20 items.
Length Constraints: Minimum length of 1. Maximum length of 128.
Required: Yes
-
- SourceDomainArn
-
The Amazon Resource Name (ARN) of the domain to compare from.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 512.
Pattern:
arn:aws[a-z\-]*:[a-z]+:[a-z0-9\-]+:[0-9]+:domain\/[a-z0-9\-]+Required: Yes
- TargetDomainArn
-
The Amazon Resource Name (ARN) of the domain to compare against.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 512.
Pattern:
arn:aws[a-z\-]*:[a-z]+:[a-z0-9\-]+:[0-9]+:domain\/[a-z0-9\-]+Required: Yes
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"Categories": {
"string" : {
"Diverged": number,
"InSync": number,
"Items": {
"Diverged": [
{
"Fields": [
{
"Path": "string",
"Policy": "string",
"SourceValue": "string",
"TargetValue": "string"
}
],
"Name": "string"
}
],
"SourceOnly": [ "string" ],
"TargetOnly": [ "string" ]
},
"SourceOnly": number,
"Status": "string",
"TargetOnly": number,
"Truncated": boolean
}
},
"SourceDomainArn": "string",
"TargetDomainArn": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- Categories
-
The comparison result for each category you requested, keyed by category name.
Type: String to CategoryDiffResult object map
Map Entries: Maximum number of 20 items.
Key Length Constraints: Minimum length of 1. Maximum length of 128.
- SourceDomainArn
-
The Amazon Resource Name (ARN) of the domain that was compared from.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 512.
Pattern:
arn:aws[a-z\-]*:[a-z]+:[a-z0-9\-]+:[0-9]+:domain\/[a-z0-9\-]+ - TargetDomainArn
-
The Amazon Resource Name (ARN) of the domain that was compared against.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 512.
Pattern:
arn:aws[a-z\-]*:[a-z]+:[a-z0-9\-]+:[0-9]+:domain\/[a-z0-9\-]+
Errors
For information about the errors that are common to all actions, see Common Error Types.
- DisabledOperationException
-
An error occured because the client wanted to access an unsupported operation.
HTTP Status Code: 409
- InternalException
-
Request processing failed because of an unknown error, exception, or internal failure.
HTTP Status Code: 500
- ResourceNotFoundException
-
An exception for accessing or deleting a resource that doesn't exist.
HTTP Status Code: 409
- ValidationException
-
An exception for accessing or deleting a resource that doesn't exist.
HTTP Status Code: 400
Examples
Example
This example illustrates one usage of CompareDomainConfiguration.
Sample Request
POST /2021-01-01/opensearch/compareDomainConfiguration HTTP/1.1
Host: es.us-east-1.amazonaws.com
Content-Type: application/json
Content-Length: 195
{"SourceDomainArn": "arn:aws:es:us-east-1:123456789012:domain/my-primary", "TargetDomainArn": "arn:aws:es:us-west-2:123456789012:domain/my-secondary", "Categories": ["templates", "ism_policies"]}
Sample Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"SourceDomainArn": "arn:aws:es:us-east-1:123456789012:domain/my-primary",
"TargetDomainArn": "arn:aws:es:us-west-2:123456789012:domain/my-secondary",
"Categories": {
"templates": {
"Status": "compared",
"InSync": 3,
"SourceOnly": 1,
"TargetOnly": 0,
"Diverged": 0,
"Items": {
"SourceOnly": [
"logs-template"
],
"TargetOnly": [],
"Diverged": []
},
"Truncated": false
},
"ism_policies": {
"Status": "compared",
"InSync": 1,
"SourceOnly": 0,
"TargetOnly": 0,
"Diverged": 1,
"Items": {
"SourceOnly": [],
"TargetOnly": [],
"Diverged": [
{
"Name": "hot-warm-delete",
"Fields": [
{
"Path": "policy.states[0].actions[0].rollover.min_size",
"SourceValue": "\"50gb\"",
"TargetValue": "\"30gb\""
}
]
}
]
},
"Truncated": false
}
}
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: