Error in History service with advanced visibility enabled

hi,

we have setup a new Temporal cluster with advanced visibility enabled. We have created the index by following the documentation.

server version: 1.20.1
ui: 1.14.0
ES: 7.10.2

All the services startup and workflow executions complete. However we are not able to see the workflows in UI.
Also, we are seeing below error in history service

{"level":"error","ts":"2023-05-02T10:08:24.367Z","msg":"ES request failed.","component":"indexer-es-processor","es-response-status":400,"es-response-error":"failed to parse field [CloseTime] of type [long] in document with id '0EFFE9A20F12449692DC969BE5B4CB7A@AXkBCgA-SAP-shuna-610406936225-0~42b3436a-9dae-4f06-8376-b88f58216778'. Preview of field's value: '2023-05-02T10:07:37.022666766Z'","key":"263~1048643","es-doc-id":"0EFFE9A20F12449692DC969BE5B4CB7A@AXkBCgA-SAP-shuna-610406936225-0~42b3436a-9dae-4f06-8376-b88f58216778","es-request":"{\"index\":{\"_index\":\"temporal-visibility-item-perf-v20-adv-es\",\"_id\":\"0EFFE9A20F12449692DC969BE5B4CB7A@AXkBCgA-SAP-shuna-610406936225-0~42b3436a-9dae-4f06-8376-b88f58216778\",\"version\":1048643,\"version_type\":\"external\"}}\n{\"CloseTime\":\"2023-05-02T10:07:37.022666766Z\",\"ExecutionDuration\":30131286770,\"ExecutionStatus\":\"Completed\",\"ExecutionTime\":\"2023-05-02T10:07:06.891379996Z\",\"HistoryLength\":42,\"HistorySizeBytes\":2089388,\"NamespaceId\":\"946f8528-4a9b-498e-9b31-27f0a998509e\",\"RunId\":\"42b3436a-9dae-4f06-8376-b88f58216778\",\"StartTime\":\"2023-05-02T10:07:06.891379996Z\",\"StateTransitionCount\":9,\"TaskQueue\":\"ITEM_INGESTION\",\"VisibilityTaskKey\":\"263~1048643\",\"WorkflowId\":\"0EFFE9A20F12449692DC969BE5B4CB7A@AXkBCgA-SAP-shuna-610406936225-0\",\"WorkflowType\":\"ItemSetupV2Workflow\"}","logging-call-at":"processor.go:281","stacktrace":"go.temporal.io/server/common/log.(*zapLogger).Error\n\t/home/builder/temporal/common/log/zap_logger.go:150\ngo.temporal.io/server/common/persistence/visibility/store/elasticsearch.(*processorImpl).bulkAfterAction\n\t/home/builder/temporal/common/persistence/visibility/store/elasticsearch/processor.go:281\ngithub.com/olivere/elastic/v7.(*bulkWorker).commit\n\t/go/pkg/mod/github.com/olivere/elastic/v7@v7.0.32/bulk_processor.go:588\ngithub.com/olivere/elastic/v7.(*bulkWorker).work\n\t/go/pkg/mod/github.com/olivere/elastic/v7@v7.0.32/bulk_processor.go:501"}

Appreciate any help.

Figured it out.
Index name should match the pattern “temporal_visibility_v1_*” mentioned in the index_template_v7.json.
Since the index name was not matching, the data types were created with default types and hence the error.