如果保持默認設置,原始文檔存儲在_source領域,就會有差異的情況下,A的原稿比情況B.大
否則,應該沒有區別:對於情況A,顏色字段的索引中沒有添加任何術語,因爲它是空的。
可以使用_size現場看到原始文檔的索引的大小,這是_source字段的大小:
POST stack
{
"mappings":{
"features":{
"_size": {"enabled":true, "store":true},
"properties":{
"price":{
"type":"byte"
},
"colors":{
"type":"string"
}
}
}
}
}
PUT stack/features/1
{
"price": 1
}
PUT stack/features/2
{
"price": 1,
"colors": []
}
POST stack/features/_search
{
"fields": [
"_size"
]
}
最後的查詢將輸出這樣的結果,這說明不是文件2需要更多的空間比1:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 1,
"hits": [
{
"_index": "stack",
"_type": "features",
"_id": "1",
"_score": 1,
"fields": {
"_size": 16
}
},
{
"_index": "stack",
"_type": "features",
"_id": "2",
"_score": 1,
"fields": {
"_size": 32
}
}
]
}
}
注:在該實例中的字段的名稱已經從「大小」爲「價格」改變,以避免與_size字段混淆。這可能並未反映在所有答案中。 – 2014-09-22 09:01:48
很好地注意到。編輯現在已經生效。 – ThomasC 2014-09-22 09:02:36