2014-08-29 47 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