P_R
P_R

Reputation: 488

Elastisearch query: problem retrieving one field for all documents

I am using Elasticsearch.Client.ElasticSearch in C# and I have a problem translating this query, that works correctly in Kibana:

GET /brand_it/_search
{  
   "_source": ["managementReference"],
   "query": {
      "match_all": {}
   }
}

I wrote this code:

var searchResponse = client.Search<Brand>(s => s
        .Source(src => src.Includes(i => i.Field(f => f.managementReference)))
        .Query(q => q.MatchAll())
        .Size(1000));   // Numero di risultati per batch

But it is not correct because lambda into .Source() throws this error:

Cannot convert anonymous method block to type 'type' because it is not a delegate type

Someone could help me?

Thanks

Upvotes: 0

Views: 35

Answers (0)

Related Questions