Skip to main content
These examples target the Relationships endpoint. The request body is a standard OpenSearch DSL query β€” combine clauses with bool (must, should, filter, must_not) as needed. For the full list of indexed fields you can query against, see OpenSearch Profile Mappings (v3).
Two different origin vocabularies. The query-side field team_connections.origins and the response-side field connections[].sources[].origin use different value sets. Use the values listed below when querying. For the response vocabulary, see the sources field FAQ.

Discovery queries

Connections to people working at a specific company

Find people in your network who currently work at a company with a given domain.
{
  "query": {
    "term": {
      "profile_info.current_company_website": {
        "value": "theswarm.com"
      }
    }
  }
}

Connections to a specific person

Identify who in your network is connected to a specific person, by LinkedIn username.
{
  "query": {
    "term": {
      "profile_info.linkedin_usernames": {
        "value": "connorsdavid"
      }
    }
  }
}

Connections to senior software engineers at selected companies

Combine seniority, role, and company filters with a bool.must clause.
{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "profile_info.current_seniorities": {
              "value": "senior"
            }
          }
        },
        {
          "match": {
            "profile_info.current_title": {
              "query": "software engineer",
              "operator": "AND"
            }
          }
        },
        {
          "terms": {
            "profile_info.current_company_website": [
              "apple.com",
              "google.com",
              "microsoft.com"
            ]
          }
        }
      ]
    }
  }
}

Filter by a specific connector

The top-level connected_users field (keyword) holds the IDs of the team members each connection originates from. Use a term query to limit results to a specific connector β€” useful when you want to see who a single team member is connected to. Replace the value with the user ID of the connector (find your team members’ IDs in Team Settings β†’ Members).
{
  "query": {
    "term": {
      "connected_users": {
        "value": "4a9a0f84-9edf-48eb-a832-bc0594d77d70"
      }
    }
  }
}
To filter by multiple connectors at once, use terms with an array of IDs.

Filtering by team connection origin

The profile document includes a nested team_connections field that stores how each connection was synced. Use a nested query against team_connections.origins, typically scoped to your team_connections.team_id, to filter results. Accepted team_connections.origins values (provisional, may change): csv, plugin, overlaps, google, google-calendar, user-profile, manual-csv, education-overlaps, investor-overlaps, manual-url.

Connections from work or education overlaps for a specific team

Scopes the origin filter to your team using team_connections.team_id. Replace <your team id> with your team ID.
{
  "query": {
    "bool": {
      "must": [
        {
          "nested": {
            "path": "team_connections",
            "query": {
              "bool": {
                "must": [
                  {
                    "term": {
                      "team_connections.team_id": {
                        "value": "<your team id>"
                      }
                    }
                  },
                  {
                    "terms": {
                      "team_connections.origins": ["overlaps"]
                    }
                  }
                ]
              }
            }
          }
        }
      ]
    }
  }
}
To filter by multiple origins, pass them in the terms array β€” for example ["overlaps", "education-overlaps"].

Combine an origin filter with a role filter

Find product managers in your team’s network who are connected via the LinkedIn plugin or shared work history.
{
  "query": {
    "bool": {
      "must": [
        {
          "nested": {
            "path": "team_connections",
            "query": {
              "bool": {
                "must": [
                  {
                    "term": {
                      "team_connections.team_id": {
                        "value": "<your team id>"
                      }
                    }
                  },
                  {
                    "terms": {
                      "team_connections.origins": ["plugin", "overlaps"]
                    }
                  }
                ]
              }
            }
          }
        },
        {
          "match": {
            "profile_info.current_title": {
              "query": "product manager",
              "operator": "AND"
            }
          }
        }
      ]
    }
  }
}