把我下面的es api语句转换成query形式
时间: 2024-03-05 19:53:27 浏览: 15
可以将下面的Elasticsearch API语句转换为相应的query查询语句:
```
POST /my_index/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"title": "Elasticsearch"
}
},
{
"match": {
"content": "query"
}
}
],
"filter": {
"range": {
"publish_date": {
"gte": "2020-01-01"
}
}
}
}
},
"sort": [
{
"publish_date": {
"order": "desc"
}
}
],
"_source": {
"includes": [ "title", "author", "publish_date" ],
"excludes": [ "content" ]
},
"size": 10,
"from": 0
}
```
对应的query查询语句如下:
```
GET /my_index/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"title": "Elasticsearch"
}
},
{
"match": {
"content": "query"
}
}
],
"filter": {
"range": {
"publish_date": {
"gte": "2020-01-01"
}
}
}
}
},
"sort": [
{
"publish_date": {
"order": "desc"
}
}
],
"_source": {
"includes": [ "title", "author", "publish_date" ],
"excludes": [ "content" ]
},
"size": 10,
"from": 0
}
```
其中,将POST请求改为GET请求,其余保持不变,即可转换为相应的query查询语句。
相关推荐
![.zip](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)