分享

kibana

 株野 2015-11-17

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"]
    }
'}

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多