有两个filter条件,应该怎么写?
GET test/_search
{
"query": {
"bool": {
"filter": {
"term": {
"name": "kevin"
},
"range": {
"age": {
"gte": 20,
"lte": 30
}
}
}
}
}
}
会报错:
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[term] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
"line": 8,
"col": 9
}
],
"type": "parsing_exception",
"reason": "[term] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
"line": 8,
"col": 9
},
"status": 400
}
GET test/_search
{
"query": {
"bool": {
"filter": {
"term": {
"name": "kevin"
},
"range": {
"age": {
"gte": 20,
"lte": 30
}
}
}
}
}
}
会报错:
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[term] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
"line": 8,
"col": 9
}
],
"type": "parsing_exception",
"reason": "[term] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
"line": 8,
"col": 9
},
"status": 400
}
1 个回复
strglee
赞同来自: create17