I'm using the Elastic.Clients.Elasticsearch NuGet package to migrate away from our existing Nest implementations. I am getting an error attempting to replicate the Nest mapping for a list of strings. If I remove the lambda containing the fields method call, it creates a normal text mapping fine. What am I doing wrong?
Nest's auto map created this mapping:
"tags": {
"type": "text",
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
}
}
I'm attempting with this test doc:
public class TestDoc : IElasticIndexable
{
public IList<string> Tags { get; set; } = new List<string>();
}
Mapping:
var r = await Client.Indices.CreateAsync<TestDoc>($"{_indexPrefix}_testdoc", c => c
.Mappings(m => m
.Properties(p => p
.Text(t => t.Tags, c => c
.Fields(f => f
.Keyword(kk => kk, cc => cc
.IgnoreAbove(256)
)
)
)
)
)
);
I get this error:
Elastic.Transport.UnexpectedTransportException: 'Sequence contains no elements'
The only details I can get from the exception are
Internal error in the expression evaluator.