es 语法
查询 id 10078 到 10576 并且name 字段包含李的
post /company/typedemo1/_search
{
"query": {
"bool": {
"must": [
{
"range": {
"id": {
"from": "10078",
"to": "10576"
}
}
},
{
"term": {
"name": "李" "bool": { "query": {{post of Wang or Li /company/typedemo1/_searchThe query id is greater than 2999000 and the name field contains the} } } ] }
}
"must": [
{
"range": {
"id": {
"gt": "2999000"
}
}
},
{
"terms": {
"name": [
"李",
"王"
]
}
}
]
}
}
}
查询 id 等于 271315046
post /company/typedemo1/_search
{
"query": {
"query_string": {
"fields": [
"id"
],
"query": 271315046
}
}
}
Query name contains Wang or Li's and posts in descending order by id
/company/typedemo1/_search
{
"query": {
"bool": {
"must": [
{
"query_string": {
"default_field": "name",
" query": "Wang Li"
}
}
]
}
},
"sort": [
{
"id": {
"order": "desc"
}
}
]
} The
query name is equal to Wang and the name field is highlighted. Take the first 20 data
post /company/typedemo1/_search
{
"query":{
"term": {
"name": "王"
}
},
"from": 0,
"size": 20,
"highlight": {
"pre_tags": [
"<tag1>",
"<tag2>"
],
"post_tags": [
"</tag1>",
"</tag2>"
],
"fields": {
"name": {}
}
}
Elasticsearch study notes <2>
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326240900&siteId=291194637
Recommended
Ranking