Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions internal/cli/deployments/search/indexes/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ func (opts *CreateOpts) RunLocal(ctx context.Context) error {
opts.indexID.Collection = index.CollectionName
opts.indexID.Name = index.Name

definition = index.Definition
definition, err = buildIndexDefinition(index.Definition)
if err != nil {
return err
}
case *atlasv2.ClusterSearchIndex:
_, _ = log.Warningln("you're using an old search index definition")
idxType = index.Type
Expand Down Expand Up @@ -163,7 +166,7 @@ func (opts *CreateOpts) RunLocal(ctx context.Context) error {
return nil
}

func buildIndexDefinition(idx *atlasv2.ClusterSearchIndex) (any, error) {
func buildIndexDefinition(idx any) (any, error) {
// To maintain formatting of the SDK, marshal object into JSON and then unmarshal into BSON
jsonIndex, err := json.Marshal(idx)
if err != nil {
Expand Down
Loading