Elasticsearch學習筆記(五)索引元數據和集群元數據
一、索引元數據
執行:GET /ecommerce/product/1
返回結果:
{
"_index": "ecommerce",
"_type": "product",
"_id": "1",
"_version": 1,
"found": true,
"_source": {
"name": "gaolujie yagao",
"desc": "gaoxiao meibai",
"price": 30,
"producer": "gaolujie producer",
"tags": [
"meibai",
"fangzhu"
]
}
}
二、集群元數據
三、document的_source元數據
添加document:
PUT /test_index/test_type/1
{
"test_field1": "test field1",
"test_field2": "test field2"
}
查詢指定document:
GET /test_index/test_type/1{
"_index": "test_index",
"_type": "test_type",
"_id": "1",
"_version": 2,
"found": true,
"_source": {
"test_field1": "test field1",
"test_field2": "test field2"
}}
_source元數據:就是說,我們在創建一個document的時候,使用的那個放在request body中的json串,默認情況下,在get的時候,會原封不動的給我們返回回來。
定制返回的結果,指定_source中,返回哪些field
GET /test_index/test_type/1?_source=test_field1,test_field2
{
"_index": "test_index",
"_type": "test_type",
"_id": "1",
"_version": 2,
"found": true,
"_source": {
"test_field2": "test field2"
}}


浙公網安備 33010602011771號