-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add schedule-related search attributes (#2953)
- Loading branch information
Showing
7 changed files
with
256 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
versioned/v1/index_template_v6.json | ||
versioned/v2/index_template_v6.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
versioned/v1/index_template_v7.json | ||
versioned/v2/index_template_v7.json |
84 changes: 84 additions & 0 deletions
84
schema/elasticsearch/visibility/versioned/v2/index_template_v6.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{ | ||
"order": 0, | ||
"index_patterns": [ | ||
"temporal_visibility_v1*" | ||
], | ||
"settings": { | ||
"index": { | ||
"number_of_shards": "1", | ||
"number_of_replicas": "0", | ||
"auto_expand_replicas": "0-2", | ||
"sort.field": [ "CloseTime", "StartTime", "RunId" ], | ||
"sort.order": [ "desc", "desc", "desc" ], | ||
"sort.missing": [ "_first", "_first", "_first" ] | ||
} | ||
}, | ||
"mappings": { | ||
"_doc": { | ||
"dynamic": "false", | ||
"properties": { | ||
"NamespaceId": { | ||
"type": "keyword" | ||
}, | ||
"WorkflowId": { | ||
"type": "keyword" | ||
}, | ||
"RunId": { | ||
"type": "keyword" | ||
}, | ||
"WorkflowType": { | ||
"type": "keyword" | ||
}, | ||
"StartTime": { | ||
"type": "date" | ||
}, | ||
"ExecutionTime": { | ||
"type": "date" | ||
}, | ||
"CloseTime": { | ||
"type": "date" | ||
}, | ||
"ExecutionDuration": { | ||
"type": "long" | ||
}, | ||
"ExecutionStatus": { | ||
"type": "keyword" | ||
}, | ||
"TaskQueue": { | ||
"type": "keyword" | ||
}, | ||
"TemporalChangeVersion": { | ||
"type": "keyword" | ||
}, | ||
"BatcherNamespace": { | ||
"type": "keyword" | ||
}, | ||
"BatcherUser": { | ||
"type": "keyword" | ||
}, | ||
"BinaryChecksums": { | ||
"type": "keyword" | ||
}, | ||
"HistoryLength": { | ||
"type": "long" | ||
}, | ||
"StateTransitionCount": { | ||
"type": "long" | ||
}, | ||
"TemporalScheduledStartTime": { | ||
"type": "date" | ||
}, | ||
"TemporalScheduledById": { | ||
"type": "keyword" | ||
}, | ||
"TemporalSchedulePaused": { | ||
"type": "boolean" | ||
}, | ||
"TemporalScheduleInfoJSON": { | ||
"type": "keyword" | ||
} | ||
} | ||
} | ||
}, | ||
"aliases": {} | ||
} |
83 changes: 83 additions & 0 deletions
83
schema/elasticsearch/visibility/versioned/v2/index_template_v7.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
{ | ||
"order": 0, | ||
"index_patterns": [ | ||
"temporal_visibility_v1*" | ||
], | ||
"settings": { | ||
"index": { | ||
"number_of_shards": "1", | ||
"number_of_replicas": "0", | ||
"auto_expand_replicas": "0-2", | ||
"search.idle.after": "365d", | ||
"sort.field": [ "CloseTime", "StartTime", "RunId" ], | ||
"sort.order": [ "desc", "desc", "desc" ], | ||
"sort.missing": [ "_first", "_first", "_first" ] | ||
} | ||
}, | ||
"mappings": { | ||
"dynamic": "false", | ||
"properties": { | ||
"NamespaceId": { | ||
"type": "keyword" | ||
}, | ||
"WorkflowId": { | ||
"type": "keyword" | ||
}, | ||
"RunId": { | ||
"type": "keyword" | ||
}, | ||
"WorkflowType": { | ||
"type": "keyword" | ||
}, | ||
"StartTime": { | ||
"type": "date_nanos" | ||
}, | ||
"ExecutionTime": { | ||
"type": "date_nanos" | ||
}, | ||
"CloseTime": { | ||
"type": "date_nanos" | ||
}, | ||
"ExecutionDuration": { | ||
"type": "long" | ||
}, | ||
"ExecutionStatus": { | ||
"type": "keyword" | ||
}, | ||
"TaskQueue": { | ||
"type": "keyword" | ||
}, | ||
"TemporalChangeVersion": { | ||
"type": "keyword" | ||
}, | ||
"BatcherNamespace": { | ||
"type": "keyword" | ||
}, | ||
"BatcherUser": { | ||
"type": "keyword" | ||
}, | ||
"BinaryChecksums": { | ||
"type": "keyword" | ||
}, | ||
"HistoryLength": { | ||
"type": "long" | ||
}, | ||
"StateTransitionCount": { | ||
"type": "long" | ||
}, | ||
"TemporalScheduledStartTime": { | ||
"type": "date_nanos" | ||
}, | ||
"TemporalScheduledById": { | ||
"type": "keyword" | ||
}, | ||
"TemporalSchedulePaused": { | ||
"type": "boolean" | ||
}, | ||
"TemporalScheduleInfoJSON": { | ||
"type": "keyword" | ||
} | ||
} | ||
}, | ||
"aliases": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu -o pipefail | ||
|
||
# Prerequisites: | ||
# - jq | ||
# - curl | ||
|
||
# Input parameters. | ||
: "${ES_SCHEME:=http}" | ||
: "${ES_SERVER:=127.0.0.1}" | ||
: "${ES_PORT:=9200}" | ||
: "${ES_USER:=}" | ||
: "${ES_PWD:=}" | ||
: "${ES_VERSION:=v7}" | ||
: "${ES_VIS_INDEX_V1:=temporal_visibility_v1_dev}" | ||
: "${AUTO_CONFIRM:=}" | ||
: "${SLICES_COUNT:=auto}" | ||
|
||
es_endpoint="${ES_SCHEME}://${ES_SERVER}:${ES_PORT}" | ||
|
||
echo "=== Step 0. Sanity check if Elasticsearch index is accessible ===" | ||
|
||
if ! curl --silent --fail --user "${ES_USER}":"${ES_PWD}" "${es_endpoint}/${ES_VIS_INDEX_V1}/_stats/docs" --write-out "\n"; then | ||
echo "Elasticsearch index ${ES_VIS_INDEX_V1} is not accessible at ${es_endpoint}." | ||
exit 1 | ||
fi | ||
|
||
echo "=== Step 1. Add new builtin search attributes ===" | ||
|
||
case $ES_VERSION in | ||
v6) date_type='date' ; doc_type='/_doc' ;; | ||
*) date_type='date_nanos' ; doc_type='' ;; | ||
esac | ||
|
||
new_mapping=' | ||
{ | ||
"properties": { | ||
"TemporalScheduledStartTime": { | ||
"type": "'$date_type'" | ||
}, | ||
"TemporalScheduledById": { | ||
"type": "keyword" | ||
}, | ||
"TemporalSchedulePaused": { | ||
"type": "boolean" | ||
}, | ||
"TemporalScheduleInfoJSON": { | ||
"type": "keyword" | ||
} | ||
} | ||
} | ||
' | ||
|
||
if [ -z "${AUTO_CONFIRM}" ]; then | ||
read -p "Add new builtin search attributes to the index ${ES_VIS_INDEX_V1}? (N/y)" -n 1 -r | ||
echo | ||
else | ||
REPLY="y" | ||
fi | ||
if [ "${REPLY}" = "y" ]; then | ||
curl --silent --user "${ES_USER}":"${ES_PWD}" -X PUT "${es_endpoint}/${ES_VIS_INDEX_V1}${doc_type}/_mapping" -H "Content-Type: application/json" --data-binary "$new_mapping" | jq | ||
# Wait for mapping changes to go through. | ||
until curl --silent --user "${ES_USER}":"${ES_PWD}" "${es_endpoint}/_cluster/health/${ES_VIS_INDEX_V1}" | jq --exit-status '.status=="green" | .'; do | ||
echo "Waiting for Elasticsearch index ${ES_VIS_INDEX_V1} become green." | ||
sleep 1 | ||
done | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters