如果有人可以帮助理解以以下两种形式创建类型之间的真正区别,我将不胜感激:
使用“映射”</h2>
放 /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>
放置 /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”没有任何“映射”定义,尽管类型中的每个字段都有特定的设置:
获取 /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"
}
}
}
}
}
我想了解这两个索引之间的哪些事情(如果有)会有所不同?