码迷,mamicode.com
首页 > 其他好文 > 详细

es 基础概念总结 —— URI Search

时间:2020-03-18 09:34:08      阅读:75      评论:0      收藏:0      [点我收藏+]

标签:查询   param   wow   通配   target   OLE   not   boolean   targe   

搜索 API

GET /<index>/_search

POST /<index>/_search

GET /_search

POST /_search

示例:

# 单个索引:
GET /twitter/_search?q=tag:wow

# 多个索引:
GET /kimchy,elasticsearch/_search?q=user:kimchy

# 全部索引:
GET /_search?q=user:kimchy
GET /_all/_search?q=user:kimchy
GET /*/_search?q=user:kimchy

 

URI Search

GET /<index>/_search?q=<parameter>

指定字段

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

泛查询

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

phrase 查询

GET /movies/_search?q=title:"Beautiful Mind"
{
	"profile":"true"
}

分组查询(非泛查询

GET /movies/_search?q=title:(Beautiful Mind)
{
	"profile":"true"
}

boolean 查询

GET /movies/_search?q=title:(Beautiful AND Mind)
{
  "profile":"true"
}

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

GET /movies/_search?q=title:(Beautiful %2BMind)
{
  "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"
}

范围查询,区间写法

GET /movies/_search?q=title:beautiful AND year:[2002 TO 2018%7D
{
	"profile":"true"
}

 

 

相关文档


https://www.elastic.co/guide/en/elasticsearch/reference/7.6/search-uri-request.html

 

es 基础概念总结 —— URI Search

标签:查询   param   wow   通配   target   OLE   not   boolean   targe   

原文地址:https://www.cnblogs.com/lemos/p/12515260.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!