首先来到kibana 页面,找到dev tool 菜单,选择Console
es的页面工具kibana中 dev tool 菜单使用_kibana中的dev tools 在哪里_nandao158的博客-CSDN博客
1、查所有的索列表
GET /_cat/indices" />POST nandao/create/1{ "name":"nan"}
删除索引
DELETE dao
3、所有库数据查询
GET _search{ "query": {"match_all": {} }}
4、针对某个索引下,随机查询,默认查询10条
GET crawler-article/_search{ "query": {"match_all": {} }}
5、分页模糊查询 查询3条
GET crawler-article/_search{ "query":{"match":{ "title": "佛"} }, "from":0, "size":3}
6、分页查询并排序
GET crawler-article/_search{ "query":{"match":{ "title": "佛"} }, "from":0, "size":3 , "sort": [{ "id": {"order": "desc" }} ]}
7、精确查询 term
GET /crawler-article/_search{ "query":{"term":{ "title":"弥"} }}
8、单条件模糊查询 match
GET /crawler-article/_search{ "query":{"match":{ "title":"佛陀啊"} }}
9、按照单个条件查询返回特定内容和条数
GET /crawler-article/_search{ "from": 0, "size": 2, "_source": ["title"], "query": {"match": { "title": "佛陀"} }}
10、当同一个属性满足逻辑或时的查询
GET /crawler-article/_search{ "query": {"bool": { "should": [{ "match": {"title": "陀" }},{ "match": {"title": "鑫" }} ]} }}
11、多条件联合并且查询
GET /crawler-article/_search{ "query": {"bool": { "must": [{ "match": {"title": "佛" }},{ "match": {"content": "陀" }} ]} }}
12、范围查询并进行排序
GET /crawler-article/_search{ "query": {"range": { "id": {"gte": 1,"lte": 23000 }} } , "sort": [{ "id": {"order": "desc" }} ]}
13、聚合查询查范围数量
GET /crawler-article/_search{ "size": 0, "aggs": {"id": { "range": {"field": "id","ranges": [ {"from": 5,"to": 8 },{"from":1 ,"to": 3 }] }} }}
14、聚合查询 aggs
GET /crawler-article/_search?pretty{ "size": 0, "query": { "match_all": { } }, "aggs": {"title": { "terms": {"field": "title.keyword" }} }}
15、filter 过滤查询
GET crawler-article/_search?pretty{ "query": {"bool": { "filter": {"range": { "id": {"gte": 1,"lte": 200 }} }} }}