Sahil Sharma
Sahil Sharma

Reputation: 4217

NEST Elastic Search: Difference between FilterInputs term and terms?

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

What would difference be between above 2 lines?

As far i have tested, the second will allow multiple cities in document with kye cityIds. Any if any matches with filterInputs.cities=> record is returned.

While first will only allow once city.If it matches=>record return else not.

Please confirm.

Upvotes: 0

Views: 175

Answers (1)

Richa
Richa

Reputation: 7649

Term allows to match only one term. According to documentation:

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

See here

while Terms allows you to specify multiple terms and match any of them.It works like in in Sql . According to documentation:

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

See here

Upvotes: 1

Related Questions