我正在尝试编写一个查询,它在 elastic 中搜索某个特定字段为 null。我们使用 Python Elasticsearch Client 在 python 中执行了这个查询。
查询:
{
"_source": ["name"],
"query": {
"nested": {
"path": "experience",
"query": {
"match": {
"experience.resignation_date": {
"query": None
}
}
}
}
}
}
自从它的 python 我在查询部分使用了 None 但它抛出了这个错误。
elasticsearch.exceptions.RequestError: TransportError(400, 'parsing_exception', '[match] unknown token [VALUE_NULL] after [query]')
最佳答案
missing
查询已弃用,您正在寻找 bool/must_not
+ exists
{
"_source": [
"name"
],
"query": {
"nested": {
"path": "experience",
"query": {
"bool": {
"must_not": {
"exists": {
"field": "experience.resignation_date"
}
}
}
}
}
}
}
关于python - 弹性查询,其中字段在弹性中为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41742148/