View a markdown version of this page

Indeks Properti: nama - Amazon DocumentDB

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Indeks Properti: nama

Jenis indeks yang didukung

Opsi 3.6 4.0 5.0 8.0 Cluster elastis
bidang tunggal Ya Ya Ya Ya Ya
senyawa Ya Ya Ya Ya Ya
multi-tombol Ya Ya Ya Ya Ya
text Tidak Tidak Ya Ya Tidak
geospasial Ya Ya Ya Ya Ya
vektor Tidak Tidak Ya Ya Tidak

Gunakan opsi nama untuk memberikan nama opsional untuk indeks.

Semua contoh menggunakan dokumen contoh berikut:

{ "productId": "PROD133726", "sku": "SKU24224", "name": "Basic Printer", "manufacturer": "The Manufacturer", "tags": [ "printer", "basic", "electronics", "business" ], "barcodes": [ "542364671", "886330670", "437445606" ], "reviews": [ { "review_date": ISODate('2024-01-19T21:37:10.585Z'), ... } ], "material": "Polycarbonate", "color": "Space Gray", "supplier": { "supplierId": "SUP4", "location": { "type": "Point", "coordinates": [ -71.0589, 42.3601 ] } }, "productEmbedding": [ -0.019320633663838058, 0.019672111388113596 ], "lastUpdated": ISODate('2025-10-20T21:37:10.585Z') }

Bidang tunggal

db.collection.createIndex( { "productId": 1 }, { "name": "single_field_index" } )

Senyawa

db.collection.createIndex( { "productId": 1, "manufacturer": 1 }, { "name": "compound_index" } )

Multi-key

db.collection.createIndex( { "tags": 1 }, { "name": "multikey_index" } )

Teks

db.collection.createIndex( { "name": "text" }, { "name": "text_index" } )

Geospasial

db.collection.createIndex( { "supplier.location": "2dsphere" }, { "name": "geospatial_index" } )

vektor

db.runCommand({ "createIndexes": "collection", "indexes": [{ "key": { "productEmbedding": "vector" }, "name": "hnsw_index", "vectorOptions": { "type": "hnsw", "dimensions": 2, "similarity": "euclidean", "m": 16, "efConstruction": 64 } }] })