Fields option using NEST

When using the Fieds options just to get a selection of fileds using the NEST client library and setting the Source(false), the Hits object's fields property is null. How are we supposed to get access to the values returned if source is also null by setting Source(false).

Example:

var searchResponse =
await ElasticSearchConfig.GetClient().SearchAsync(x => x.Index(indices)
.Size(1000)
.Source(sr => sr
.Includes(fi => fi
.Fields(
f => f.Id,
f => f.Name,
f => f.Age,
f => f.Address,
f => f.DateRegistered
)
)).Source(false)
.Query(q => q
.Bool(bq =>
bq.Filter(
fq => fq.DateRange(t => t.Field(f => f.DateRegistered).LessThanOrEquals(DateTimeOffset.UtcNow.AddDays(7).ToString("o"))))
)));

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