[英]Elasticsearch query syntax
我有一个映射索引如下
"mappings": {
"properties": {
"name": {
"type": "text"
},
"id": {
"type": "integer"
},
"is_active": {
"type": "boolean"
},
"attributes": {
"dynamic": true,
"properties": {
"subjects": {
"type": "integer"
},
"occupation": {
"type": "integer"
}
}
现在我想获取所有职业 =4 且名称不类似于 'Test' 和 is_active = True 的文档包含“测试”
{
"query": {
"bool": {
"must": [
{
"bool": {
"should": [
{
"terms": {
"audience_attributes.occupation": [
4
]
}
}
]
}
},
{
"terms": {
"is_active": [
true
]
}
}
]
}
}
}
我正在使用 Elasticsearch 7.9
我想我明白了
{
"query": {
"bool": {
"must_not": {
"wildcard": {
"name": {
"value": "*TEST*"
}
}
},
"must": [
{
"bool": {
"should": [
{
"terms": {
"audience_attributes.occupation": [
4
]
}
}
]
}
},
{
"terms": {
"is_active": [
true
]
}
}
]
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.