gpt4 book ai didi

elasticsearch - 不在Elasticsearch的搜索查询中

转载 作者:行者123 更新时间:2023-12-03 01:39:37 24 4
gpt4 key购买 nike

我想知道是否有一个使用Elasticsearch DSL的搜索查询来查找所有值,除了那些满足数据库中dateOptionalTime字段上的某些条件的值。

等效的SQL query为:

select * from index 
where (not (date="0001-01-01T00:00:00+03:30"))
and (domain="somthing.com");

最佳答案

是的,您可以使用bool/must_not实现此目的:

{
"query": {
"bool": {
"filter": {
"term": {
"domain": "something.com"
}
},
"must_not": {
"term": {
"date": "0001-01-01T00:00:00+03:30"
}
}
}
}
}

关于elasticsearch - 不在Elasticsearch的搜索查询中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48909208/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com