0

In NEST, Elasticsearch library for .NET. For highlighting on query.

In Highlight method of NEST, How we can pass an array of actions as parameter to onFields(Action<HighlightFieldDescriptor<T>>[] fielddata) method?

thanks.

Delimitry
  • 2,987
  • 4
  • 30
  • 39
user2352554
  • 521
  • 4
  • 17
  • Maybe this one will help http://stackoverflow.com/questions/30436373/elasticsearch-net-nest-object-initializer-syntax-for-a-highlight-request/30436812#30436812 – Rob Jun 27 '15 at 14:19
  • i'd change the title... – OhadR Jun 27 '15 at 22:02

1 Answers1

1

You could try the below:

var highlighters = new Action<HighlightFieldDescriptor<YourObject>>[3];
highlighters[0] = h => h.OnField("field1");
highlighters[1] = h => h.OnField("field2");
highlighters[2] = h => h.OnField("field3");

searchDescriptor.Highlight(h => h.OnFields(highlighters));
Manolis
  • 728
  • 8
  • 24