query 的形式、人物搜索可筛选的字段及各字段接受的运算符,以及请求的写法。
人物请求发送到 POST /search/people。如需搜索公司,参见公司搜索。
编写查询
query 的形式取决于搜索模式:
-
Ludicrous 接受一个 JSON 对象,由可搜索字段上的条件通过
and、or和not组合而成。操作符和取值形式参见 Business Search 查询语法。 -
Instant 和 Smart 接受一句不超过 200 个字符的自然语言。Business Search 会把这句话转换为作用于同一组字段的一个结构化查询,并将其识别为以下两种意图之一:
- 发现(Discovery):按角色查找档案,例如 “Cloud engineers in the United States with an AWS certification”。每个搜索词都必须命中,命中位置可以是
role字段组,也可以是句子中指明的职位和雇主字段。只在雇主或教育经历上命中、或只命中部分词的档案不会返回。 - 指名查找(Named lookup):句子中给出某个人的姓名、档案 URL 或多个人的列表。匹配结果按姓名排序。
experience_years筛选条件。句子中的城市会匹配精确的city值或location文本。 - 发现(Discovery):按角色查找档案,例如 “Cloud engineers in the United States with an AWS certification”。每个搜索词都必须命中,命中位置可以是
可搜索字段
字段接受哪些运算符取决于字段类型。文本类型字段只接受text 运算符;字符串、整数等有类型字段接受 equals、in 和 range。对文本字段使用 equals 会返回 HTTP 400。
| 字段 | 类型 | 运算符 | 说明 |
|---|---|---|---|
current_title | 文本 | text | 用 mode: "all" 要求每个词都命中 |
all_text | 文本 | text | 同时搜索职位、角色和简介 |
name | 文本 | text | |
about | 文本 | text | |
location | 文本 | text | 描述性地点字符串 |
current_company_name | 文本 | text | |
current_company_industry | 文本 | text | |
past_job_titles | 文本 | text | |
past_company_names | 文本 | text | 档案中过往职位的雇主名称。参见示例 |
certification_names | 文本 | text | 档案中列出的认证,例如 AWS |
education_schools | 文本 | text | 档案中列出的学校 |
education_details | 文本 | text | 档案中列出的学位和专业 |
role、company、skill | 文本 | text | 每个都同时搜索一组字段:role 覆盖 current_title、past_job_titles 和 about;company 覆盖 current_company_industry、specialties、description、slogan 和 name;skill 覆盖 about 和 certification_names |
city | 字符串 | equals、in | 精确城市名 |
country_code | 字符串 | equals、in | ISO 3166 alpha-2 代码,例如 US 或 GB |
linkedin_person_id | 字符串 | equals、in | id_only 视图返回的档案标识符 |
experience_years | 整数 | equals、in、range | 总工作年限 |
current_tenure_months | 整数 | range | 担任当前职位的月数 |
followers | 整数 | range |
部分档案可能缺少地点和雇主字段,字段缺失不代表对应的现实信息不成立:没有
current_company_name 的档案只是没有公开雇主。请在不影响整条记录的前提下处理空值或 null,并避免使用会把所有可选字段为空的档案默默剔除的过滤条件。示例请求
- Ludicrous
- Instant
- Smart
以下 Ludicrous 请求查找当前职位同时包含 示例响应返回的三条记录中的第一条:
cloud 和 engineer、认证中包含 AWS 的美国档案,并指定 5 个输出字段:示例请求curl --request POST "https://api.brightdata.com/search/people" \
--header "Authorization: Bearer $BRIGHTDATA_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"mode": "ludicrous",
"query": {
"and": [
{ "text": { "current_title": { "value": "cloud engineer", "mode": "all" } } },
{ "equals": { "country_code": "US" } },
{ "text": { "certification_names": "AWS" } }
]
},
"offset": 0,
"limit": 3,
"view": { "fields": ["current_title", "country_code", "experience_years", "certification_names", "current_company_industry"] }
}'
import os
import requests
response = requests.post(
"https://api.brightdata.com/search/people",
headers={
"Authorization": f"Bearer {os.environ['BRIGHTDATA_API_KEY']}",
"Content-Type": "application/json",
},
json={
"mode": "ludicrous",
"query": {
"and": [
{ "text": { "current_title": { "value": "cloud engineer", "mode": "all" } } },
{ "equals": { "country_code": "US" } },
{ "text": { "certification_names": "AWS" } }
]
},
"offset": 0,
"limit": 3,
"view": { "fields": ["current_title", "country_code", "experience_years", "certification_names", "current_company_industry"] }
},
)
print(response.text)
const response = await fetch("https://api.brightdata.com/search/people", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.BRIGHTDATA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"mode": "ludicrous",
"query": {
"and": [
{ "text": { "current_title": { "value": "cloud engineer", "mode": "all" } } },
{ "equals": { "country_code": "US" } },
{ "text": { "certification_names": "AWS" } }
]
},
"offset": 0,
"limit": 3,
"view": { "fields": ["current_title", "country_code", "experience_years", "certification_names", "current_company_industry"] }
}),
});
console.log(await response.text());
{
"req_id": "r01c2b3e9fcbe43c5addc134d263e31a6",
"source": "linkedin_people",
"meta": {
"coverage_percent": 100,
"matched": 26,
"offset": 0,
"limit": 3
},
"documents": [
{
"bright_id": "349830f7c438a21b669ef445eb0c664fa5504aba543d962ef49079b91680e395",
"data": {
"current_title": "Cloud Engineer",
"country_code": "US",
"experience_years": 7,
"certification_names": "AWS Certified Cloud Practitioner; AWS Certified Solutions Architect - Associate; Microsoft Certified: Azure Data Engineer Associate; Microsoft Certified: Azure Fundamentals",
"current_company_industry": "Paint, Coating, and Adhesive Manufacturing"
}
}
]
}
text 条件中的 mode: "all" 要求每个搜索词都命中,但这些词不必构成完整短语,因此职位为 “Cloud DevOps Engineer” 的档案同样会匹配。词与词之间的标点不影响匹配,词序不影响匹配,职位中包含额外词语也允许。以下 Instant 请求用一句话查找同一类档案:示例请求示例响应返回的三条记录中的第一条:
curl --request POST "https://api.brightdata.com/search/people" \
--header "Authorization: Bearer $BRIGHTDATA_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"mode": "instant",
"query": "Cloud engineers in the United States with an AWS certification",
"limit": 3,
"view": { "fields": ["current_title", "country_code", "experience_years", "certification_names", "current_company_industry"] }
}'
import os
import requests
response = requests.post(
"https://api.brightdata.com/search/people",
headers={
"Authorization": f"Bearer {os.environ['BRIGHTDATA_API_KEY']}",
"Content-Type": "application/json",
},
json={
"mode": "instant",
"query": "Cloud engineers in the United States with an AWS certification",
"limit": 3,
"view": { "fields": ["current_title", "country_code", "experience_years", "certification_names", "current_company_industry"] }
},
)
print(response.text)
const response = await fetch("https://api.brightdata.com/search/people", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.BRIGHTDATA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"mode": "instant",
"query": "Cloud engineers in the United States with an AWS certification",
"limit": 3,
"view": { "fields": ["current_title", "country_code", "experience_years", "certification_names", "current_company_industry"] }
}),
});
console.log(await response.text());
{
"req_id": "r59e660e756a04de0a8483e40e2dec8e3",
"source": "linkedin_people",
"meta": {
"coverage_percent": 100,
"matched": 20182,
"offset": 0,
"limit": 3
},
"documents": [
{
"bright_id": "df585dcfa99ea4851162832ece551c15e4aff9e7ccebacf46a4cb76560aeae3d",
"data": {
"current_title": "Cloud Engineer",
"country_code": "US",
"experience_years": 11,
"certification_names": "AWS Certified Solutions Architect – Associate"
}
}
]
}
以下 Smart 请求发送同一句话,并按每条记录对请求的契合程度对候选结果排序:示例请求示例响应返回的三条记录中的第一条:
curl --request POST "https://api.brightdata.com/search/people" \
--header "Authorization: Bearer $BRIGHTDATA_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"mode": "smart",
"query": "Cloud engineers in the United States with an AWS certification",
"limit": 3,
"view": { "fields": ["current_title", "country_code", "experience_years", "certification_names", "current_company_industry"] }
}'
import os
import requests
response = requests.post(
"https://api.brightdata.com/search/people",
headers={
"Authorization": f"Bearer {os.environ['BRIGHTDATA_API_KEY']}",
"Content-Type": "application/json",
},
json={
"mode": "smart",
"query": "Cloud engineers in the United States with an AWS certification",
"limit": 3,
"view": { "fields": ["current_title", "country_code", "experience_years", "certification_names", "current_company_industry"] }
},
)
print(response.text)
const response = await fetch("https://api.brightdata.com/search/people", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.BRIGHTDATA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"mode": "smart",
"query": "Cloud engineers in the United States with an AWS certification",
"limit": 3,
"view": { "fields": ["current_title", "country_code", "experience_years", "certification_names", "current_company_industry"] }
}),
});
console.log(await response.text());
{
"req_id": "r09f4cacc56c846d68062daced8435a09",
"source": "linkedin_people",
"meta": {
"coverage_percent": 100,
"matched": 20182,
"offset": 0,
"limit": 3
},
"documents": [
{
"bright_id": "d97da1626ee72b552dbf1af4c782f4ecd668cf50d420dbad89e6384c07f5a549",
"data": {
"current_title": "Cloud Engineer",
"country_code": "US",
"experience_years": 9,
"certification_names": "AWS Academy Graduate - AWS Academy Cloud Architecting; AWS Academy Graduate - AWS Academy Cloud Foundations; AWS Certified Solutions Architect – Associate; Cloud Architect Diploma; Developing CI/CD Solutions with Azure DevOps; Kubernetes: Microservices",
"current_company_industry": "Real Estate"
}
}
]
}
view 与 query 的关系,参见 Business Search 字段视图。
更多经过测试的请求,参见 Business Search 查询示例。