es 基础概念总结 —— URI Search

Posted lemos

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了es 基础概念总结 —— URI Search相关的知识,希望对你有一定的参考价值。

搜索 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的主要内容,如果未能解决你的问题,请参考以下文章

记录es的URI search搜索方式

Elasticsearch中URI Search和RequestBody Search分析

Elasticsearch中URI Search和RequestBody Search分析

[JavaScript]ES5基础知识总结

es常见查询语句总结

浅谈Spring Data ElasticSearch