简体   繁体   English

ElasticSearch在列表上搜索 <Guid> 使用Nest C#

[英]ElasticSearch searching on List<Guid> using Nest C#

I used to have type Person with field Guid MetroStation , and I was searching in elastic: 我曾经在字段Guid MetroStation上输入Person ,而我正在用Elastic搜索:

.Query(q => q.Term(tr => tr.Field(fl => fl.MetroStation).Value(MyMetroStation))

Now am changing Guid to List<Guid> . 现在将Guid更改为List<Guid> How can I search in elastic for this? 如何搜索弹性呢?

You won't need to change your search in any way if you are looking to find Person documents where the MetroStation Guids contain the Guid in the query. 如果要查找在MetroStation指南中查询中包含该Guid的“ Person文档,则无需进行任何更改。

If you're looking for Person documents where the MetroStation Guids contain exactly what is in the query, then you might consider also indexing the number of Guids in the collection to also query on . 如果要查找MetroStation Guid包含查询中确切内容的“ Person文档,则您可以考虑同时索引​​集合中的Guid数量以进行查询 You can achieve this without indexing the count by using a script query, but if you're looking for performance, then indexing the count will likely perform better (measure it for your use case). 您可以通过使用脚本查询而无需为计数编制索引来实现此目的,但是,如果您正在寻找性能,那么对计数编制索引可能会更好地执行(针对您的用例进行测量)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM