You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _migration-assistant/migration-phases/replay-captured-traffic.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -323,4 +323,34 @@ The following metrics are also reported:
323
323
324
324
Metrics and dashboards pushed to CloudWatch may experience a visibility lag of around 5 minutes. CloudWatch also retains higher-resolution data for a shorter period than lower-resolution data. For more information, see [Amazon CloudWatch concepts](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html).
325
325
326
+
## Troubleshooting
327
+
328
+
### Elasticsearch content type and accept header compatibility
329
+
330
+
Newer Elasticsearch clients (version 7.11 and later, including all 8.x versions) use Elasticsearch-specific media types in both `Content-Type` and `Accept` headers. These clients may send headers such as:
When migrating to OpenSearch or another service that does not support these Elasticsearch-specific media types, requests from these clients may fail or be rejected by the target cluster.
336
+
337
+
**Important**: If you are using Elasticsearch clients version 7.11 or later and migrating to OpenSearch or a service that does not recognize `application/vnd.elasticsearch+json` media types, you need to apply a transformation to convert both the `Content-Type` and `Accept` headers to the standard `application/json` format.
338
+
{: .note}
339
+
340
+
To resolve this issue, configure Traffic Replayer with a transformation that converts the Elasticsearch-specific media types to the standard `application/json` format. Add the following transformation to your Traffic Replayer configuration using the `--transformer-config` option:
341
+
342
+
```json
343
+
[
344
+
{
345
+
"JsonJSTransformerProvider": {
346
+
"initializationScript": "const NEW_CONTENT_TYPE = \"application/json\";\nconst ELASTIC_CONTENT_TYPE = \"application/vnd.elasticsearch+json\";\n\nfunction transform(request, context) {\n let headers = request.get(\"headers\");\n if (headers) {\n let contentType = headers.get(\"Content-Type\");\n if (Array.isArray(contentType)) {\n headers.set(\"Content-Type\", contentType.map(v => v.includes(ELASTIC_CONTENT_TYPE) ? NEW_CONTENT_TYPE : v));\n } else if (typeof contentType === \"string\") {\n if (contentType.includes(ELASTIC_CONTENT_TYPE)) {\n headers.set(\"Content-Type\", NEW_CONTENT_TYPE);\n }\n }\n let accept = headers.get(\"Accept\");\n if (Array.isArray(accept)) {\n headers.set(\"Accept\", accept.map(v => v.includes(ELASTIC_CONTENT_TYPE) ? NEW_CONTENT_TYPE : v));\n } else if (typeof accept === \"string\") {\n if (accept.includes(ELASTIC_CONTENT_TYPE)) {\n headers.set(\"Accept\", NEW_CONTENT_TYPE);\n }\n }\n }\n return request;\n}\n\nfunction main(context) {\n return (request) => {\n if (Array.isArray(request)) {\n return request.flat().map(item => transform(item, context));\n }\n return transform(request, context);\n };\n}\n(() => main)();",
347
+
"bindingsObject": "{}"
348
+
}
349
+
}
350
+
]
351
+
```
352
+
{% include copy.html %}
353
+
354
+
This transformation script automatically detects Elasticsearch-specific media types in both `Content-Type` and `Accept` headers (including those with version parameters like `compatible-with=8`) and replaces them with the standard `application/json` format, ensuring compatibility with OpenSearch and other services that do not support the Elasticsearch-specific media types.
Copy file name to clipboardExpand all lines: _migration-assistant/migration-phases/reroute-source-to-proxy.md
+33-14Lines changed: 33 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,29 +63,48 @@ Note the records in the logging topic.
63
63
64
64
After a short period, re-execute the same command again and compare the increased number of records against the expected HTTP requests.
65
65
66
-
## Backfilling documents to the source cluster
66
+
## Troubleshooting
67
67
68
-
From your source cluster snapshot, you can begin backfilling documents into the target cluster. Once you have started this process, a fleet of workers will spin up to read the snapshot and reindex documents into the target cluster. This fleet of workers can be scaled to increase the speed at which documents are reindexed into the target cluster.
68
+
### Host header routing configuration
69
69
70
-
### Checking the starting state of the clusters
70
+
Some systems, such as Elastic Cloud and other hosted Elasticsearch services, use the Host header for routing traffic to the appropriate cluster. When using the Capture Proxy with these systems, you need to configure the proxy to set the Host header to match your source cluster's domain.
71
71
72
-
You can check the indexes and document counts of the source and target clusters by running the `cat-indices` command. This can be used to monitor the difference between the source and target for any migration scenario. Check the indexes of both clusters using the following command:
72
+
**Important**: This configuration is required for Elastic Cloud deployments and any system that uses Host header-based routing. Without this setting, requests will fail with an error response like `{"ok":false,"message":"Unknown resource."}` on Elastic Cloud or be misrouted on other systems.
73
+
{: .note}
74
+
75
+
To configure the Host header, add the `captureProxyExtraArgs` parameter to your `cdk.context.json` file:
**Tip**: The Host header value should include only the domain name without the protocol (https://) or port number.
94
+
{: .tip}
95
+
96
+
#### Validating the configuration
80
97
81
-
```shell
82
-
SOURCE CLUSTER
83
-
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
84
-
green open my-index WJPVdHNyQ1KMKol84Cy72Q 1 0 8 0 44.7kb 44.7kb
98
+
Before routing production traffic through the Capture Proxy, validate that the proxy is correctly configured by sending test requests directly to it. You can use `curl` to verify the connection:
85
99
86
-
TARGET CLUSTER
87
-
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
88
-
green open .opendistro_security N3uy88FGT9eAO7FTbLqqqA 1 0 10 0 78.3kb 78.3kb
100
+
```bash
101
+
curl -k https://<capture-proxy-endpoint>:9200/
89
102
```
103
+
{% include copy.html %}
104
+
105
+
If the Host header configuration is correct, you should receive a successful or authentication failure response from your source cluster. If you receive an error like `{"ok":false,"message":"Unknown resource."}`, verify that:
106
+
- The `captureProxyExtraArgs` parameter is correctly set in your `cdk.context.json`
107
+
- The Host header value matches your source cluster's domain exactly
108
+
- You have redeployed the Capture Proxy service after making configuration changes
0 commit comments