elasticsearch中如何只查询index的所有文档名
How to Query just all the documents name of index in elasticsearch
PS:我是 elasticsearch 新手
http://localhost:9200/indexname/domains/<mydocname>
假设我们有 indexname
作为我们的索引,我正在 <mydoc>
上传大量文档,域名为 ex:
http://localhost:9200/indexname/domains/google.com
http://localhost:9200/indexname/domains/company.com
查看 http://localhost:9200/indexname/_count
,说我们有 "count": 119687
份文件。
我只希望我的弹性搜索 return 所有 119687
条目的 文档名称 是域名。
我如何实现它,是否可以在一个查询中实现它?
查看示例:http://localhost:9200/indexname/domains/google.com
我假设您的 doc_type 是 domains
并且 doc id/"document name" 是 google.com
.
_id
是此处的文档名称,它始终是响应的一部分。您可以使用 source filtering 来禁用源,它将只显示如下内容:
GET indexname/_search
{
"_source": false
}
输出
{
...
"hits" : [
{
"_index" : "indexname",
"_type" : "domains",
"_id" : "google.com",
"_score" : 1.0
}
]
...
}
如果 documentname
是映射的字段,那么您仍然可以使用源过滤来仅包含该字段。
GET indexname/_search
{
"_source": ["documentname"]
}
PS:我是 elasticsearch 新手
http://localhost:9200/indexname/domains/<mydocname>
假设我们有 indexname
作为我们的索引,我正在 <mydoc>
上传大量文档,域名为 ex:
http://localhost:9200/indexname/domains/google.com
http://localhost:9200/indexname/domains/company.com
查看 http://localhost:9200/indexname/_count
,说我们有 "count": 119687
份文件。
我只希望我的弹性搜索 return 所有 119687
条目的 文档名称 是域名。
我如何实现它,是否可以在一个查询中实现它?
查看示例:http://localhost:9200/indexname/domains/google.com
我假设您的 doc_type 是 domains
并且 doc id/"document name" 是 google.com
.
_id
是此处的文档名称,它始终是响应的一部分。您可以使用 source filtering 来禁用源,它将只显示如下内容:
GET indexname/_search
{
"_source": false
}
输出
{
...
"hits" : [
{
"_index" : "indexname",
"_type" : "domains",
"_id" : "google.com",
"_score" : 1.0
}
]
...
}
如果 documentname
是映射的字段,那么您仍然可以使用源过滤来仅包含该字段。
GET indexname/_search
{
"_source": ["documentname"]
}