elasticsearch 弹性搜索&;嵌套查询
如何查询包含特定字符串的所有记录 例如: 如果那些在db
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
{
"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查询和嵌套查询。。