2014-08-29 51 views
-1

有沒有辦法讓我只從我的Document &的_source中找到數據,而不是像_index,_type,_id,_score這樣的其他元數據,同時從Index中檢索它?只從elasticsearch中檢索_source

+0

在這裏看看:https://開頭stackoverflow.com/questions/23283033/filter-out-metadata-fields-彈性搜索 – wangchunli 2017-07-14 09:29:48

回答

1

我懂了如何去做。

GET /<index>/<type>/<id>/_source 

只會返回_source字段。

例子: 與ID 123

PUT /website/blog/123 
{ 
    "title": "My first blog entry", 
    "text": "Just trying this out...", 
    "date": "2014/01/01" 
} 

創建文檔只獲得了_source

GET /website/blog/123/_source 

返回:

{ 
    "title": "My first blog entry", 
    "text": "Just trying this out...", 
    "date": "2014/01/01" 
} 
+0

如何在mongoosastic或npm elasticsearch模塊中執行此操作? – 2015-08-19 22:17:49