SSED
SSED

Reputation: 525

Nest ElasticSearch cannot convert Lambda expression

The following VB code is intended to add an alias index to a nest elastic search but the final line receives an error -

"lambda expression cannot be converted to NEST.IAliasRequest because Nest.IAliasRequest is not a delegate type"

    Dim client = ConnectToSearch()

    Dim Person = New Person With {.Id=  Id, .Description = Description, .Tags = Tags}

    client.Alias(Sub(a) a.Add(Function(add) add.Index("Person").Alias("Account1")))

Upvotes: 0

Views: 281

Answers (1)

Rob
Rob

Reputation: 9979

client.[Alias](Function(descriptor) descriptor.Add(Function(a) a.Index("Person").[Alias]("Account1")))

UPDATE

Maybe this one will help you create alias with filter.

client.[Alias](Function([alias]) [alias].Add(Function(a) a.Index(indexName).[Alias]("alias").Filter(Of Person)(Function(f) f.Term("relationships.staffID", staffID))))

Hope this helps.

Upvotes: 1

Related Questions