| 1 |
description: "createSearchIndexes" |
| 2 |
schemaVersion: "1.4" |
| 3 |
createEntities: |
| 4 |
- client: |
| 5 |
id: &client0 client0 |
| 6 |
useMultipleMongoses: false |
| 7 |
observeEvents: |
| 8 |
- commandStartedEvent |
| 9 |
- database: |
| 10 |
id: &database0 database0 |
| 11 |
client: *client0 |
| 12 |
databaseName: *database0 |
| 13 |
- collection: |
| 14 |
id: &collection0 collection0 |
| 15 |
database: *database0 |
| 16 |
collectionName: *collection0 |
| 17 |
|
| 18 |
runOnRequirements: |
| 19 |
- minServerVersion: "7.0.0" |
| 20 |
topologies: [ replicaset, load-balanced, sharded ] |
| 21 |
serverless: forbid |
| 22 |
|
| 23 |
tests: |
| 24 |
- description: "empty index definition array" |
| 25 |
operations: |
| 26 |
- name: createSearchIndexes |
| 27 |
object: *collection0 |
| 28 |
arguments: |
| 29 |
models: [] |
| 30 |
expectError: |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
isError: true |
| 35 |
errorContains: Atlas |
| 36 |
expectEvents: |
| 37 |
- client: *client0 |
| 38 |
events: |
| 39 |
- commandStartedEvent: |
| 40 |
command: |
| 41 |
createSearchIndexes: *collection0 |
| 42 |
indexes: [] |
| 43 |
$db: *database0 |
| 44 |
|
| 45 |
|
| 46 |
- description: "no name provided for an index definition" |
| 47 |
operations: |
| 48 |
- name: createSearchIndexes |
| 49 |
object: *collection0 |
| 50 |
arguments: |
| 51 |
models: [ { definition: &definition { mappings: { dynamic: true } } , type: 'search' } ] |
| 52 |
expectError: |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
isError: true |
| 57 |
errorContains: Atlas |
| 58 |
expectEvents: |
| 59 |
- client: *client0 |
| 60 |
events: |
| 61 |
- commandStartedEvent: |
| 62 |
command: |
| 63 |
createSearchIndexes: *collection0 |
| 64 |
indexes: [ { definition: *definition, type: 'search'} ] |
| 65 |
$db: *database0 |
| 66 |
|
| 67 |
- description: "name provided for an index definition" |
| 68 |
operations: |
| 69 |
- name: createSearchIndexes |
| 70 |
object: *collection0 |
| 71 |
arguments: |
| 72 |
models: [ { definition: &definition { mappings: { dynamic: true } } , name: 'test index' , type: 'search' } ] |
| 73 |
expectError: |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
isError: true |
| 78 |
errorContains: Atlas |
| 79 |
expectEvents: |
| 80 |
- client: *client0 |
| 81 |
events: |
| 82 |
- commandStartedEvent: |
| 83 |
command: |
| 84 |
createSearchIndexes: *collection0 |
| 85 |
indexes: [ { definition: *definition, name: 'test index', type: 'search' } ] |
| 86 |
$db: *database0 |
| 87 |
|
| 88 |
- description: "create a vector search index" |
| 89 |
operations: |
| 90 |
- name: createSearchIndexes |
| 91 |
object: *collection0 |
| 92 |
arguments: |
| 93 |
models: [ { definition: &definition { fields: [ {"type": "vector", "path": "plot_embedding", "numDimensions": 1536, "similarity": "euclidean"} ] }, |
| 94 |
name: 'test index' , type: 'vectorSearch' } ] |
| 95 |
expectError: |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
isError: true |
| 100 |
errorContains: Atlas |
| 101 |
expectEvents: |
| 102 |
- client: *client0 |
| 103 |
events: |
| 104 |
- commandStartedEvent: |
| 105 |
command: |
| 106 |
createSearchIndexes: *collection0 |
| 107 |
indexes: [ { definition: *definition, name: 'test index', type: 'vectorSearch' } ] |
| 108 |
$db: *database0 |