elasticsearch 弹性搜索&;嵌套查询,elasticsearch,nest,elasticsearch,Nest" /> elasticsearch 弹性搜索&;嵌套查询,elasticsearch,nest,elasticsearch,Nest" />

elasticsearch 弹性搜索&;嵌套查询

elasticsearch 弹性搜索&;嵌套查询,elasticsearch,nest,elasticsearch,Nest,如何查询包含特定字符串的所有记录 例如: 如果那些在db { "ip": "185.239.131.76", "domain": "http://express.com", "event_type": "page_view" }, { "ip": "185.239.131.76", "domain": "http://express.com", "event_type": "page_view" }, { "ip": "37.39.244.71", "domain": "http://expre

如何查询包含特定字符串的所有记录

例如:

如果那些在db

{
"ip": "185.239.131.76",
"domain": "http://express.com",
"event_type": "page_view"
},
{
"ip": "185.239.131.76",
"domain": "http://express.com",
"event_type": "page_view"
},
{
"ip": "37.39.244.71",
"domain": "http://express.com",
"event_type": "view"
},
我想获取所有包含字符串“page”的记录

所以我只得到上面3条记录中的前2条

还可以显示http查询和嵌套查询吗


谢谢

您可以尝试后期查询:

查询:

{
    "query": {
        "match": {
            "event_type": "page_view"
        }
    }

如果我正确理解了您的问题,您有一个字段
event\u type
,它的值类似于
page\u view
view
,可能还有
page\u action
,但值是单个字符串

我在
事件类型
中查询
页面
的方法是将
事件类型
映射为
未分析
如下
映射

"event_type": {
  "index": "not_analyzed",
  "type": "string"
},
然后查询以
page
like开头的字符串

GET yourIndex/_search
{ "query": {
    "prefix": {
      "event_type": {
          "value": "page"
      }
    }
}

显示您的http查询和嵌套查询。。