作者:捕鱼达人2602917825 | 来源:互联网 | 2023-06-23 10:31
课程DemoDELETEblogsPUTblogs_doc1{title:Aboutpopularity,content:Inthispostwewilltalkab
![技术分享图片](https://img6.php1.cn/3cdc5/9b88/78c/48a784695528cb8e.png)
![技术分享图片](https://img6.php1.cn/3cdc5/9b88/78c/b2c01b770b1fa3ca.png)
![技术分享图片](https://img6.php1.cn/3cdc5/9b88/78c/06dcdfcae53358fc.png)
![技术分享图片](https://img6.php1.cn/3cdc5/9b88/78c/2a9ceec45e217f5c.png)
![技术分享图片](https://img6.php1.cn/3cdc5/9b88/78c/ee65068daab82f98.png)
![技术分享图片](https://img6.php1.cn/3cdc5/9b88/78c/9d5e6c9f690ac515.png)
![技术分享图片](https://img6.php1.cn/3cdc5/9b88/78c/0297877aa45f4111.png)
![技术分享图片](https://img6.php1.cn/3cdc5/9b88/78c/262fd15d079222fd.png)
课程Demo
DELETE blogs
PUT /blogs/_doc/1
{
"title": "About popularity",
"content": "In this post we will talk about...",
"votes": 0
}
PUT /blogs/_doc/2
{
"title": "About popularity",
"content": "In this post we will talk about...",
"votes": 100
}
PUT /blogs/_doc/3
{
"title": "About popularity",
"content": "In this post we will talk about...",
"votes": 1000000
}
POST /blogs/_search
{
"query": {
"function_score": {
"query": {
"multi_match": {
"query": "popularity",
"fields": [ "title", "content" ]
}
},
"field_value_factor": {
"field": "votes"
}
}
}
}
POST /blogs/_search
{
"query": {
"function_score": {
"query": {
"multi_match": {
"query": "popularity",
"fields": [ "title", "content" ]
}
},
"field_value_factor": {
"field": "votes",
"modifier": "log1p"
}
}
}
}
POST /blogs/_search
{
"query": {
"function_score": {
"query": {
"multi_match": {
"query": "popularity",
"fields": [ "title", "content" ]
}
},
"field_value_factor": {
"field": "votes",
"modifier": "log1p" ,
"factor": 0.1
}
}
}
}
POST /blogs/_search
{
"query": {
"function_score": {
"query": {
"multi_match": {
"query": "popularity",
"fields": [ "title", "content" ]
}
},
"field_value_factor": {
"field": "votes",
"modifier": "log1p" ,
"factor": 0.1
},
"boost_mode": "sum",
"max_boost": 3
}
}
}
POST /blogs/_search
{
"query": {
"function_score": {
"random_score": {
"seed": 911119
}
}
}
}