diff --git a/scripts/rca-demo/data/mapping-component-template-message-alias.json b/scripts/rca-demo/data/mapping-component-template-message-alias.json new file mode 100644 index 0000000000..bc8527558e --- /dev/null +++ b/scripts/rca-demo/data/mapping-component-template-message-alias.json @@ -0,0 +1,15 @@ +{ + "template": { + "mappings": { + "properties": { + "body_text": { + "type": "match_only_text" + }, + "message": { + "type": "alias", + "path": "body_text" + } + } + } + } +} \ No newline at end of file diff --git a/scripts/rca-demo/post-setup b/scripts/rca-demo/post-setup index d8251bf675..1f9dde07be 100755 --- a/scripts/rca-demo/post-setup +++ b/scripts/rca-demo/post-setup @@ -69,13 +69,18 @@ create_rule 9055220c-8fb1-4f9f-be7c-0a33eb2bafc5 rule-01.json echo -e "\n" # Update mappings in ES -# NOTE: this will fail if the data stream is not created -# TODO: Update the component template also, and just swallow errors on this call -title "Attempting to add message alias for otel logs" + +# NOTE: this one will fail if the data stream is not created yet, that's ok +title "Attempting to add message alias for otel logs index" curl -X PUT "$OTEL_DEMO_ES_ENDPOINT/logs-*otel*/_mapping" -H "Authorization: ApiKey $OTEL_DEMO_ES_API_KEY" -H "Content-Type: application/json" -d @$SCRIPTS_DIR/data/mapping-message-alias.json echo -e "\n" +title "Attempting to add message alias for logs-otel@mappings component template" +curl -X PUT "$OTEL_DEMO_ES_ENDPOINT/_component_template/logs-otel@mappings" -H "Authorization: ApiKey $OTEL_DEMO_ES_API_KEY" -H "Content-Type: application/json" -d @$SCRIPTS_DIR/data/mapping-component-template-message-alias.json + +echo -e "\n" + # Enable EEM title "Attempting to enable EEM" curl -X PUT -u "$KIBANA_USER:$KIBANA_PASSWORD" -H "kbn-xsrf: bananas" -H "x-elastic-internal-origin: Kibana" $KIBANA_URL/internal/entities/managed/enablement \ No newline at end of file