[英]Elastic Search Nest- Compare two fields
I'm struggling to compare two fields using Elastic Search Nest client for c#, can somebody help me to achieve this? 我正在努力使用c#的Elastic Search Nest客户端比较两个字段,有人可以帮助我实现这一点吗? For Example : I've two fields like FirstName & Name in my index, I want to compare these fields.
例如:我在索引中有两个字段,例如FirstName和Name,我想比较这些字段。
You can make this kind of comparison with a Script query 您可以通过脚本查询进行这种比较
var client = new ElasticClient();
var response = client.Search<Question>(s => s
.Query(q => q
.Script(sq => sq
.Source("doc['name'].value == doc['fullName'].value")
)
)
);
This retrieves the values from doc values and makes the assumption that both fields are indexed as keyword
fields; 这将从doc值中检索值,并假设两个字段都被索引为
keyword
字段; doc values are not supported with text
fields. text
字段不支持doc值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.