NEST Elasticsearch:过滤器输入术语和术语之间的区别?

NEST Elastic Search: Difference between FilterInputs term and terms?

FilterInputs mustfilters;
mustfilters &= ms.Term("cityId", filterInputs.cities);
mustfilters &= ms.Terms("cityIds", filterInputs.cities);

以上两行有什么区别?

据我测试,第二个将允许在带有 kye cityIds 的文档中包含多个城市。任何与 filterInputs.cities=> 记录匹配的任何内容都是 returned.

虽然 first 只允许一次 city.If 它匹配=>记录 return 否则不匹配。

请确认。

Term 只允许匹配一个词。根据文档:

The term query finds documents that contain the exact term specified in the inverted index.

here

Terms 允许您指定多个术语并匹配 them.It 中的任何一个,就像 Sql 中的 in 一样。根据文档:

Terms Query Filters documents that have fields that match any of the provided terms (not analyzed).

here