方法一:
GET myIndex/_doc/_search
{
"query": {
"bool": {
"must_not": {
"exists": {
"field": "myFieldName1"
}
}
}
}
}
方法二:
GET myIndex/_doc/_search
{
"query": {
"query_string": {
"query": "-_exists_:field1 and _exists_:field2 and -_exists_:field3"
}
}
}
“-_exists_” 号代表不存在,"_exists_" 号代表存在。上面的意思是:不包含field1,包含field2 ,不包含field3