问题描述
在让NEST的DeleteByQuery方法起作用时,我遇到了一些困难.
I'm having a little difficulty getting NEST's DeleteByQuery method to work.
非常简单,查询从未找到要删除的内容,我也不知道为什么.我正在使用相同的查询来返回记录(使用搜索"),并且一切正常.
Very simply the query never finds anything to delete, and I can't figure out why. I'm using the same query to return records (using Search) and everything works as expected.
private void Delete(MyClass someObject)
{
var response = elasticClient.DeleteByQuery<MyClass>(q => q
.Match(m => m.OnField(f => f.Guid).Equals(someObject.Guid))
);
}
我才刚刚开始使用NEST,所以我确定这是一个非常简单的问题,而且我有点昏暗!
I've only just started using NEST, so I'm sure this is a pretty simple problem and I'm just being a little dim!
非常感谢您的帮助/建议.
Any help/suggestions much appreciated.
推荐答案
.Equals()
是Object
上的.NET方法,用于检查是否相等.
The .Equals()
is a .NET method on Object
that checks for equality.
如果将呼叫从Equals()
更改为Query(someObject.Guid)
,它应该可以工作.
If you change the call to Equals()
to Query(someObject.Guid)
it should work.
这篇关于使用NEST和ElasticSearch的DeleteByQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!