search - Elasticsearch 返回给定类型的所有文档

标签 search elasticsearch types document document-types

几天来我一直在寻找这个问题的解决方案。用例只是简单地只查看特定类型的文档。通常在谷歌搜索很长时间后,我最终会得到一些带有通配符的搜索查询。我浏览了很多 SO 帖子,例如 this , thiselastic documentation还。我尝试了以下网址,但没有任何运气。

curl -XGET 'localhost:9200/analytics/test/_search' -d '
{

   "query" : {
   "match_all" : {}
    }
}'

curl -XGET 'localhost:9200/analytics/test/_search' -d '
{
    "query": {
        "type":{
            "value": "test"
            }
    }
}'

是否有类似通配符搜索的文档类型来返回该特定 doc_type 的所有文档?

最佳答案

要从 test 类型的索引 analytics 中获取所有文档,只需运行:

curl -XGET localhost:9200/analytics/test/_search

curl -XGET localhost:9200/analytics/test/_search -d '{
    "query": {"match_all" : {}}
}'

如果您的用户数量超过默认大小值,您需要提供 from/size 值,如所述 here .

关于search - Elasticsearch 返回给定类型的所有文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42695154/

相关文章:

php - 使用 CakePHP 和 MySQL 进行搜索

c# - 在 .bin 文件中查找 bmp

search - 尝试为 Haskell 二叉树搜索实现路径记录

angular - @Types/node/index.d.ts TypeScript 错误 TS2309

Scala Class[_$1] 其中类型 _$1

android如何在arraylist中找到相似的字符串

elasticsearch - 这些设置如何使 Elasticsearch 在开发模式下运行?

elasticsearch - 使用JAVA Api代码进行多个字段的Elastic Search文档更新的解决方案

python - Boto3 put_object() 很慢

function - 如何将任意数据类型写入Matlab元胞数组