When I sort like this:
.Sort(sortDescriptor => sortDescriptor.Descending(product => product.TopProduct))
I have no hits. Any idea why? Is the syntax wrong or what? I got this from the official NEST/elasticsearch docs site.
SOLUTION
I had to add .Suffix("keyword") like this:
.Sort(sortDescriptor => sortDescriptor.Descending(product => product.TopProduct.Suffix("keyword")))
And it worked. I had to use the "keyword" subfield on "TopProduct".
Default mapping for String propertiesedit: When using Auto Mapping, the inferred mapping for a string POCO type is a text datatype with multi fields including a keyword sub field
If you index a string with no mapping, ES in 5.0+ now automatically creates a text version and a keyword version (under .keyword) of the field. - dakroneLee HinmanElastic Team Member
Source: https://discuss.elastic.co/t/is-sorting-on-text-string-field-no-longer-available-in-5-x/68586/4
This worked but could someone explain to me how the text and keyword datatypes work?