Get Array FieldValues ElasticSearch NEST

Is there a way to get Arrays returned in FieldValues using NEST.
Consider the following query

            var searchResponse = client.Search<VehicleSpecs>(s => s
                .Index("specs")
                .Source(false)
                .Size(1000)
                .Query(q => q
                    .MatchAll()
                )
                .Fields(fs => fs
                    .Field(vs => vs.VehiclePhotos)));

VehiclePhotos is a an array of string in the above example but when I try to read it back it only returns first element from the array. Here is what I have tried so far

            foreach (var fields in searchResponse.Fields)
            {
                //var c = fields.ValueOf<VehicleSpecs, List<string>>(vs => vs.VehiclePhotos).Count;
                var photo= fields.Value<string>("vehiclePhotos");
            }

The commented line throws an error if i uncomment it

You can use

foreach (var fields in searchResponse.Fields)
{
	string[] photo = fields.ValuesOf<string>("vehiclePhotos");
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.