Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

通过kibana提供的接口查询elasticstack里面的数据 #107

Open
lizhongzhen11 opened this issue Apr 6, 2021 · 0 comments
Open

通过kibana提供的接口查询elasticstack里面的数据 #107

lizhongzhen11 opened this issue Apr 6, 2021 · 0 comments

Comments

@lizhongzhen11
Copy link
Owner

第一次用,老大让我把csv文件里的数据导入进去,然后通过REST服务或者我自己写个服务来调用查询,一开始很懵逼,毕竟没接触过,不断的去查资料发现可以直接在 kibana 提供的 Console 功能来查询,打开F12可以看到相应的接口调用以及传参,不过传参这里需要踩下坑:

  • 一开始默认只返回10条数据,这肯定不行,调用接口时设置下 from 为 0 以及 size
  • 默认最多展示10000条数据,但是我数据源有26W条,需要改下 https://blog.csdn.net/yournevermore/article/details/84259038
  • 默认返回的 hits.total.value 不正确,查询时加上 "track_total_hits": true 即可
  • 模糊匹配问题,值加个 *
  • 多条件查询,也能搜到

最后来个示例:

GET /bmappoi2/_search
{
  "track_total_hits": true,
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "area": "邗江区"
          }
        },
       {
         "wildcard": {
           "address": "兰苑*"
         }
       }
      ]
    }
  },
  from: 0,
  size: 99999
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant