Elasticsearch NEST fluent DSL Field name .Suffix causes syntax error

425 Views Asked by At

Using NEST DSL to filter on the "keyword" suffix of the FileLogNum field.

public class ElasticSearchAttachment
{
    public string FileLogNum { get; set; }
}

which elasticsearch returns as

{"mappings": {"properties":"fileLogNum":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}}}}

Here is my fluent dsl query

var results = elasticClient.Search<ElasticSearchAttachment>(search => search
    .Query(q => q
        .Bool(b => b
            .Filter(fl => fl
                .Term(t => t.FileLogNum.Suffix("keyword"), "19-113257")
            )
        )
    )

with intellisense generating an error on "FileLogNum.Suffix" of "CS1061: TermQueryDesciptor does not contain a definition for 'FileLogNum' ..."

No where else do I see anyone mentioning not being able to use .Suffix in this situation.

NEST and Elasticsearch dotnet are on version 7.10.0.

Sure there is something simple I am missing, but I am not seeing it. Any thoughts would be appreciated.

1

There are 1 best solutions below

0
On

Sigh. PEBCAK. Never put in the using Nest; statement. There goes 4 hours of my life.