码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Kibana中的Dev Tools常用语法


    查询相关语法

    1. ### 查询所有
    2. GET _search
    3. {
    4. "query": {
    5. "match_all": {}
    6. }
    7. }
    8. ### 查询单个索引 的 固定属性
    9. --- 精确匹配
    10. GET _search
    11. {
    12. "query": {
    13. "term": { "name" : "you" }
    14. }
    15. }
    16. ### 模糊匹配
    17. GET _search
    18. {
    19. "query": {
    20. "match": { "name" : "you" }
    21. }
    22. }
    23. ### 范围查找
    24. GET _search
    25. {
    26. "query": {
    27. "range": {
    28. "age":{ "gte" : 15 , "lte" : 25 }
    29. }
    30. }
    31. }
    32. ### 功能性查询
    33. --- 过滤
    34. GET my_index/_search
    35. {
    36. "query": {
    37. "bool": {
    38. "filter": {
    39. "term":{"age":1095}
    40. }
    41. }
    42. }
    43. }
    44. --- 或 or
    45. GET my - test / _search {
    46. "query": {
    47. "bool": {
    48. "should": [{
    49. "term": {
    50. "name": "you"
    51. }
    52. }, {
    53. "match": {
    54. "age": 20
    55. }
    56. }]
    57. }
    58. }
    59. }
    60. --- 与 AND
    61. GET my-test/_search
    62. {
    63. "query": {
    64. "bool": {
    65. "must" : [{
    66. "match" : {
    67. "name" : "you"
    68. }
    69. },{
    70. "range":{
    71. "age":{
    72. "from" : 10 , "to" : 20
    73. }
    74. }
    75. }]
    76. }
    77. }
    78. }
    79. ---必须 =
    80. GET my_index/_search
    81. {
    82. "query": {
    83. "bool": {
    84. "must" : {
    85. "range" : {
    86. "age" : { "from" : 10, "to" : 20 }
    87. }
    88. }
    89. }
    90. }
    91. }
    92. --- 必须不 not
    93. GET my_index/_search
    94. {
    95. "query": {
    96. "bool": {
    97. "must_not" : {
    98. "term" : {
    99. "name" : "you"
    100. }
    101. }
    102. }
    103. }
    104. }
    105. ## 复合查找
    106. GET my_index/_search
    107. {
    108. "query": {
    109. "bool": {
    110. "should": [{
    111. "match": {
    112. "age": 40
    113. }
    114. },
    115. {
    116. "match": {
    117. "age": 20
    118. }
    119. }],
    120. "filter": {
    121. "match":{
    122. "name":"you"
    123. }
    124. }
    125. }
    126. }
    127. }

    参考文档

    1. ### 参考文档
    2. https://zhuanlan.zhihu.com/p/370392324

    查询记录是否存在

    1. ##
    2. HEAD myindex/_doc/1

    查询限制条数

    1. ###
    2. GET mes-data-api-daemon-2022.11.16/_search?size=1
    3. {
    4. }

    match查询

    常用于模糊搜索

    1. ## 查询指定索引的匹配查询
    2. GET mes-data-api-daemon-2022.11.16/_search
    3. {
    4. "query": {
    5. "match": {
    6. "message": "请检查执行机器列表信息"
    7. }
    8. }
    9. }

    term查询

    常用于精确匹配

    1. GET test_record/_search
    2. {
    3. "query": {
    4. "term": {
    5. "sn" : "H101ZAB1ZE7G0002"
    6. }
    7. }
    8. }

    复合查找

    多个条件同时满足才返回

    1. ###
    2. GET mes-data-api-daemon-2022.11.16/_search
    3. {
    4. "query": {
    5. "bool": {
    6. "should": [
    7. {
    8. "match": {
    9. "_id" : "o_kGfIQB8nBHSUlxPl-L"
    10. }},
    11. {
    12. "match": {
    13. "host.name": "xx-xx-mes-app-prd-01"
    14. }
    15. }
    16. ]
    17. }
    18. }
    19. }

  • 相关阅读:
    【WIFI】【WPS】如何从log角度判断WPS 已经连接上
    记录mac安装基础软件问题
    谷歌翻译软件-大家都在下载的谷歌翻译软件
    LeetCode【42. 接雨水】
    PHREEQC建模及典型案例解析与高阶拓展应用【反向“编译”、“玩转”后处理技术、GibbsStudio和PhreePlo方法】
    Centos 7 xshell连接不上虚拟机的2种方法
    JavaScript-Object.is()和‘===’ ‘==’比较运算符的区别
    【Python】Python 将一个文件夹备份到一个 ZIP 文件
    重装系统全流程
    读高性能MySQL(第4版)笔记08_创建高性能索引(上)
  • 原文地址:https://blog.csdn.net/knight_zhou/article/details/127985640
  • 最新文章
  • 沪漂五周年了:我越来越迷茫了
    Agentic Skill Routing 实战:别再把所有 Skill 塞进 AI Agent 上下文
    MySQL-Seconds_behind_master的精度误差
    [MAF预定义ChatClient中间件-03]CachingChatClient——利用缓存省钱省时间
    AI的至暗历史:从万众期待到被政府撤资,AI的两次死亡徘徊
    Agent OS :五种驯服不确定性的范式
    PortSwigger SQL注入LAB11
    数据库即时编译JIT
    [Begin]AI Learn Data Day 0
    深度学习进阶(二十七)现代 LLM 的核心架构设计其二:SwiGLU
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号