

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# インデックスプロパティ: name
<a name="index-property-name"></a>

## サポートされているインデックスタイプ
<a name="index-property-name-supported"></a>


| オプション | 3.6 | 4.0 | 5.0 | 8.0 | Elastic クラスター | 
| --- | --- | --- | --- | --- | --- | 
| 単一フィールド | はい  | はい | はい | はい | はい | 
| compound | はい  | はい | はい | はい | はい | 
| マルチキー | はい  | はい | はい | はい | はい | 
| テキスト | いいえ | なし | はい | はい | いいえ | 
| 地理空間 | はい  | はい | はい | はい | はい | 
| ベクトル | いいえ | なし | はい | はい | いいえ | 

name オプションを使用して、インデックスのオプションの名前を指定します。

すべての例では、次のサンプルドキュメントを使用します。

```
{
  "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')
}
```

## 単一フィールド
<a name="index-property-name-single-field"></a>

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

## 複合
<a name="index-property-name-compound"></a>

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

## マルチキー
<a name="index-property-name-multi-key"></a>

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

## テキスト
<a name="index-property-name-text"></a>

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

## 地理空間
<a name="index-property-name-geospatial"></a>

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

## Vector
<a name="index-property-name-vector"></a>

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