打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
kibana

12月12日北京OSC源创会 —— 开源技术的年终盛典 ?  

目录[-]

ElasticSearch查询功能包括query和filter,使用RestAPI:_search方法进行查询。

Search

参数

  • l Timeout:超时时间
  • l From:等于offset
  • l Size:返回长度。
  • l Search_type:查询类型。
  • l Query_cache1.4之后的版本。是否使用查询缓存。
  • l Terminate_after1.4之后的版本。一个Shard可以在获取到多少条数据后,停止查询。

TODO:Shard query cache.

示例

1,查询匹配this is a test的document。

1
2
3
4
5
6
7
curl 'localhost:9200/idx/_search?pretty' -d '{
    "query": {
    "match" : {
           "message" : "this is a test"
        }
    }
'}

2,指定需要返回的字段


1
2
3
4
5
6
7
8
curl 'localhost:9200/idx/_search?pretty' -d '{
    "query": {
    "match" : {
           "message" : "this is a test"
        },
        "_source" : ["name"]
    }
'}

12月12日北京OSC源创会 —— 开源技术的年终盛典 ?  

目录[-]

ElasticSearch查询功能包括query和filter,使用RestAPI:_search方法进行查询。

Search

参数

  • l Timeout:超时时间
  • l From:等于offset
  • l Size:返回长度。
  • l Search_type:查询类型。
  • l Query_cache1.4之后的版本。是否使用查询缓存。
  • l Terminate_after1.4之后的版本。一个Shard可以在获取到多少条数据后,停止查询。

TODO:Shard query cache.

示例

1,查询匹配this is a test的document。

1
2
3
4
5
6
7
curl 'localhost:9200/idx/_search?pretty' -d '{
    "query": {
    "match" : {
           "message" : "this is a test"
        }
    }
'}

2,指定需要返回的字段


1
2
3
4
5
6
7
8
curl 'localhost:9200/idx/_search?pretty' -d '{
    "query": {
    "match" : {
           "message" : "this is a test"
        },
        "_source" : ["name"]
    }
'}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
ElasticSearch之CURL操作
Elasticsearch【分词基本情况资料】
ES 常用命令
最完整的Elasticsearch 基础教程
? MySQL 中 GROUP BY 基本实现原理
lucene3.0 中BooleanQuery 的使用 | 亲亲宝宝
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服