elasticsearch 的 URL 查询

喜夏-厌秋 提交于 2020-03-15 12:01:18

示例

GET /movies/_search?q=2012&df=title
{
  "profile": true
}

# 泛查询
GET /movies/_search?q=2012
{
  "profile": true
}

# 指定字段查询
GET /movies/_search?q=title:2012
{
  "profile": true
}


#Term or phrase
# "beautiful mind" 等价于 beautiful AND mind, 还要求前后顺序保持一致
# beautiful mind 等价于 beautiful OR mind

# 使用引号,短语查询
GET /movies/_search?q=title:"beautiful mind"
{
  "profile": true
}

# 分组查询
GET /movies/_search?q=title:(beautiful mind)
{
  "profile": true
}

# 错误使用分组,mind 为泛查询
GET /movies/_search?q=title:beautiful mind
{
  "profile": true
}

# 逻辑运算
GET /movies/_search?q=title:(beautiful AND mind)
{
  "profile": true
}

GET /movies/_search?q=title:(beautiful NOT mind)
{
  "profile": true
}

# 范围查询
GET /movies/_search?q=year:>1980
{
  "profile": true
}

# 通配符查询
GET /movies/_search?q=title:b*
{
  "profile": true
}

# 模糊查询
GET /movies/_search?q=title:beautifl~1
{
  "profile": "true"
}

GET /movies/_search?q=title:"lord rings"~2
{
  "profile": "true"
}

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!