amazon web services - Create mappings for an opensearch index with cdk - Stack Overflow

I have been trying to add OpenSearch Serverless to my CDK (I use ts). But when I try to create a mappin

I have been trying to add OpenSearch Serverless to my CDK (I use ts). But when I try to create a mapping for an index it fails.

Here is the mapping CDK code:

const indexMapping = {
                properties: {
                    account_id: {
                        type: "keyword"
                    },
                    address: {
                        type: "text",
                    },
                    city: {
                        fields: {
                            keyword: {
                                type: "keyword",
                            },
                        },
                        type: "text",
                    },
                    created_at: {
                        format: "strict_date_optional_time||epoch_millis",
                        type: "date",
                    },
                    created_at_timestamp: {
                        type: "long",
                    },
                    cuopon: {
                        type: "text",
                    },
                    customer: {
                        fields: {
                            keyword: {
                                ignore_above: 256,
                                type: "keyword",
                            },
                        },
                        type: "text",
                    },
                    delivery_time_window: {
                        fields: {
                            keyword: {
                                ignore_above: 256,
                                type: "keyword",
                            },
                        },
                        type: "text",
                    },
                    email: {
                        fields: {
                            keyword: {
                                ignore_above: 256,
                                type: "keyword",
                            },
                        },
                        type: "text",
                    },
                    jane_store: {
                        properties: {
                            id: {
                                type: "keyword",
                            },
                            name: {
                                type: "text",
                            },
                        },
                        type: "object",
                    },
                    objectID: {
                        type: "keyword",
                    },
                    order_number: {
                        fields: {
                            keyword: {
                                ignore_above: 256,
                                type: "keyword",
                            },
                        },
                        type: "text",
                    },
                    reservation_start_window: {
                        format: "strict_date_optional_time||epoch_millis",
                        type: "date",
                    },
                    reservation_start_window_timestamp: {
                        type: "long",
                    },
                    status: {
                        type: "keyword",
                    },
                    store_id: {
                        type: "keyword",
                    },
                    total_price: {
                        type: "float",
                    },
                    type: {
                        type: "keyword",
                    },
                },
            };

            this.opensearchIndex = new aoss.CfnIndex(this, "OpenSearchIndex", {
                collectionEndpoint:
                    this.environmentConfig.aoss.CollectionEndpoint,
                indexName: prefix,
                mappings: indexMapping,
            });

And, this is the error I got in codebuild:

[#/Mappings/Properties/store_id/Type: keyword is not a valid enum value,
#/Mappings/Properties/reservation_start_window_timestamp/Type: long is not a valid enum value, 
#/Mappings/Properties/jane_store/Type: object is not a valid enum value,
#/Mappings/Properties/jane_store/Properties/id/Type: keyword is not a valid enum value,
#/Mappings/Properties/total_price/Type: float is not a valid enum value,
#/Mappings/Properties/created_at_timestamp/Type: long is not a valid enum value, #/Mappings/Properties/created_at/Type: date is not a valid enum value,
#/Mappings/Properties/reservation_start_window/Type: date is not a valid enum value,
#/Mappings/Properties/type/Type: keyword is not a valid enum value,
#/Mappings/Properties/account_id/Type: keyword is not a valid enum value,
#/Mappings/Properties/objectID/Type: keyword is not a valid enum value,
#/Mappings/Properties/status/Type: keyword is not a valid enum value]

And the frustrating part is that when I create the exact mapping in the collection Dashboard using the Dev Tool, it works just fine.

Can anyone spot the issue here or show me some working examples of a mapping creation in the CDK?

Thanks in advance.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744183757a4562105.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信