[英]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.