You can use the exists
filter combined with a bool/must
filter like this:
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"exists": {
"field": "price"
}
},
... <-- your other constraints, if any
]
}
}
}
}
}
DEPRECATED (since ES5) You can also use the missing
filter combined with a bool/must_not
filter:
{
"query": {
"filtered": {
"filter": {
"bool": {
"must_not": [
{
"missing": {
"field": "price"
}
}
]
}
}
}
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…