Nested queries: Filter number of nested objects returned from FIND



I was wondering if it possible to filter the number of nested objects that FIND returns in a filtered nested query? Consider the following:

public class Team 
 public Team(string name)
  TeamName = name; 
  Players = new List();
 public string TeamName { get; set; }
 public List Players { get; set; }
public class Player
  public string FirstName { get; set; }
  public string LastName { get; set; }
  public int Salary { get; set; }

result = client.Search()
 .Filter(x => x.Players, p => p.FirstName.Match("player1") & 


Team 1 contains player1 (name = player1)and player2 (name = player2)
Team 2 contains player3  (name = player3) and player4 (name = player4) 

I would like to achive a search result from find that contains
Team1 with Players only containing the object player1. Is it possible? Now it seems like FIND returns Team 1 with both player1 and player2.


Feb 19, 2016 8:40

i am in the same situation. have you sorted it out?


Jan 03, 2018 15:51
Can you try MatchContained and see if that returns what you need?

result = client.Search<Team>() .Filter(x => x.Players.MatchContained( p => p.FirstName, "Ronaldo"));

If not, how about using Projections and creating an anonymous object of what you need?

Jan 15, 2018 20:07
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.