elasticsearch搜索入门

查看index

GET /_cat/indices?v

查看node节点

GET /_cat/nodes?v

where treeCodes like ‘%xx%’ order by createTime desc

GET env_account_change_2022_03_10/_search
{
“query”: {“match_phrase”: {
“treeCodes”: “729587218411520”
}},“sort”: [
{
“createTime”: {
“order”: “desc”
}
}
]
}

select count(*) from where treeCode like ‘%7330934%’

GET account_change_2022_03_09/_count
{
“query”: {“match_phrase”: {
“treeCodes”: 733093426640896
}
}
}

select * from where treeCodes like ‘%xxx%’;

GET account_change_2022_03_09/_search
{
“query”: {“match_phrase”: {
“treeCodes”: 733093426640896
}
}
}

select enterpriseId,targetId where actionType = 1 order by enterpriseId desc

GET account_change_2022_03_09/_search
{
“query”: {“match”: {
“actionType”: 1
}
},"_source": [“enterpriseId”,“targetId”]

}

where actionType = 1 order by enterpriseId desc

GET account_change_2022_03_09/_search
{
“query”: {“match”: {
“actionType”: 1
}
},“sort”: [
{
“enterpriseId”: {
“order”: “desc”
}
}
]
}

where actionType = 1 limit 0 ,20

GET account_change_2022_03_09/_search
{
“query”: {“match”: {
“actionType”: 1
}
},“size”: 20,“from”:0
}

where actionType = 1 group by enterpriseId

GET account_change_2022_03_09/_search
{
“query”: {“match”: {
“actionType”: 1
}
},“size”: 0,
“aggs”: {
“group_by_sector”: {
“terms”: {
“field”: “enterpriseId”,
“size”: 10
}
}
}
}

where actionType = 1 group by accountId

GET dev104_account_action_event_2022_03_09/_search
{
“size”: 0,
“query”: {
“match”: {
“actionType”: 1
}
},
“aggs”: {
“group_by_state”: {
“terms”: {
“field”: “accountId”
}
}
}
}

where accountId = ? and actionType in()

GET dev104_account_action_event_2022_03_09/_search
{
“query”: {
“bool”: {
“must”: [
{“match”: {
“accountId”: “730856098557952”
}}
],
“should”: [
{“match”: {
“actionType”: 1
}},
{
“match”: {
“actionType”: 2
}
}
]
}
}
}

group by accountId

GET dev104_account_action_event_2022_03_09/_search
{
“size”: 0,
“aggs”: {
“group_by_state”: {
“terms”: {
“field”: “accountId”
}
}
}
}

where accountId = ? and actionType in() group by accountId

GET dev104_account_action_event_2022_03_09/_search
{
“size”: 0,
“query”: {
“bool”: {
“must”: [
{“match”: {
“accountId”: “730856098557952”
}}
],
“should”: [
{“match”: {
“actionType”: 1
}},
{
“match”: {
“actionType”: 2
}
}
]
}
},
“aggs”: {
“group_by_state”: {
“terms”: {
“field”: “accountId”
}
}
}
}

参考: https://mp.weixin.qq.com/s?__biz=MzU1Nzg4NjgyMw%3D%3D&idx=1&mid=2247484699&scene=21&sn=5367206c3c3da2278821dd9fad648850#wechat_redirect

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值