es 基础概念总结 —— URI Search

搜索 API

GET //_search

POST //_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 //_search?q=

指定字段

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"
}

%2B 表示 +

通配符查询

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"
}

%7D 表示 } 。其中 {} 开区间, [] 是闭区间

 

相关文档


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

https://www.w3school.com.cn/tags/html_ref_urlencode.html

 

你可能感兴趣的:(es 基础概念总结 —— URI Search)