1

次の2つの形式でタイプを作成することの本当の違いは何かを誰かが理解するのを手伝ってくれれば幸いです:

「マッピング」の使用</h2>

PUT /mybestfares_test1

{
    "mappings": {
        "bestfares_data": {
          "dynamic" : false,
            "properties": {
                "airline": {
                    "type": "string",
                    "index": "not_analyzed",
                    "null_value": "N/A"
                },
                "destinationAirport": {
                    "type": "string",
                    "index": "not_analyzed",
                    "null_value": "N/A"
                },
                "originAirport": {
                    "type": "string",
                    "index": "not_analyzed",
                    "null_value": "N/A"
                },
                "sellPrice": {
                    "type": "double",
                    "null_value": 0
                }
            }
        }
    }
}

「マッピング」を使用しない場合</h2>

PUT /mybestfares_test2/

{
    "bestfares_data": {
        "dynamic" : false,
        "properties": {
            "airline": {
                "type": "string",
                "index": "not_analyzed",
                "null_value": "N/A"
            },
            "destinationAirport": {
                "type": "string",
                "index": "not_analyzed",
                "null_value": "N/A"
            },
            "originAirport": {
                "type": "string",
                "index": "not_analyzed",
                "null_value": "N/A"
            },
            "sellPrice": {
                "type": "double",
                "null_value": 0
            }
        }
    }
}

これらの両方のインデックスのインデックス情報を取得すると、「mybestfares_test2」には「マッピング」定義がないことは明らかですが、タイプの各フィールドには特定の設定があります。

GET /mybestfares_test2 =>

{
   "mybestfares_test2": {
      "mappings": {},
      "settings": {
         "index": {
            "creation_date": "1423741207570",
            "uuid": "ognGDfnTS7i9AVE1L66UgA",
            "number_of_replicas": "1",
            "number_of_shards": "5",
            "version": {
               "created": "1040299"
            },
            "bestfares_data": {
              "dynamic" : false,
               "properties": {
                  "destinationAirport": {
                     "type": "string",
                     "null_value": "N/A",
                     "index": "not_analyzed"
                  },
                  "sellPrice": {
                     "type": "double",
                     "null_value": "0"
                  },
                  "originAirport": {
                     "type": "string",
                     "null_value": "N/A",
                     "index": "not_analyzed"
                  },
                  "airline": {
                     "type": "string",
                     "null_value": "N/A",
                     "index": "not_analyzed"
                  }
               }
            }
         }
      }
   }
}

もちろん、マッピングを使用して作成されたインデックスには、マッピング内のフィールドに関する同じ設定がありますが、{...} セクション GET /mybestfares_test1

{
   "mybestfares_test1": {
      "mappings": {
         "bestfares_data": {
          "dynamic" : false,
            "properties": {
               "airline": {
                  "type": "string",
                  "index": "not_analyzed",
                  "null_value": "N/A"
               },
               "destinationAirport": {
                  "type": "string",
                  "index": "not_analyzed",
                  "null_value": "N/A"
               },
               "originAirport": {
                  "type": "string",
                  "index": "not_analyzed",
                  "null_value": "N/A"
               },
               "sellPrice": {
                  "type": "double",
                  "null_value": 0
               }
            }
         }
      },
      "settings": {
         "index": {
            "creation_date": "1423741360578",
            "uuid": "rZ8wc2-2TGKVo8ZVd8YIKg",
            "number_of_replicas": "1",
            "number_of_shards": "5",
            "version": {
               "created": "1040299"
            }
         }
      }
   }
}

これら 2 つのインデックス間でどのような動作が異なるか (ある場合) を理解したいですか?

4

2 に答える 2

0

応答をよく見ると、マッピングなしで作成した 2 番目のインデックスは、実際にはいくつかの追加設定を取得します。したがって、その場合はマッピングを提供しません。したがって、最初のものだけが正しいものです。

于 2015-02-12T13:05:30.950 に答える