query 的形式、人物搜索可筛选的字段及各字段接受的运算符,以及请求的写法。
人物请求发送到 POST /search/people。如需搜索公司,参见公司搜索。
编写查询
query 的形式取决于搜索模式:
- Ludicrous 接受一个 JSON 对象,由可搜索字段上的条件通过
and、or和not组合而成。操作符和取值形式参见 Business Search 查询语法。 - Instant 和 Smart 接受一句不超过 200 个字符的自然语言。Business Search 会把这句话转换为作用于同一组字段的一个结构化查询。查找某个职位的句子按职位、角色和简介文本一起排序;读起来像招聘需求、同时包含角色、行业和技能的句子,则在
role、company和skill字段组上分别独立打分。
可搜索字段
字段接受哪些运算符取决于字段类型。文本类型字段只接受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 |
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 |
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": "r018d477cc83c4b159a0e025356c643c1",
"source": "linkedin_people",
"meta": {
"coverage_percent": 100,
"matched": 21,
"offset": 0,
"limit": 3
},
"documents": [
{
"bright_id": "ab4836dd873d818b83aaf202941b81facbb622fa1525f7dc975c13fad913a0b7",
"data": {
"current_title": "Cloud Engineer",
"country_code": "US",
"experience_years": 3,
"certification_names": "AWS Academy Graduate - AWS Academy Cloud Developing; AWS Academy Graduate - AWS Academy Data Analytics; AWS Certified Cloud Practitioner; AWS Certified Security – Specialty; AWS Certified Solutions Architect – Associate; AWS Certified Solutions Architect – Professional",
"current_company_industry": "IT Services and IT Consulting"
}
}
]
}
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": "r2290386e6db84503af080ba7c70b4cd7",
"source": "linkedin_people",
"meta": {
"coverage_percent": 100,
"matched": 24300,
"offset": 0,
"limit": 3
},
"documents": [
{
"bright_id": "ab4836dd873d818b83aaf202941b81facbb622fa1525f7dc975c13fad913a0b7",
"data": {
"current_title": "Cloud Engineer",
"country_code": "US",
"experience_years": 3,
"certification_names": "AWS Academy Graduate - AWS Academy Cloud Developing; AWS Academy Graduate - AWS Academy Data Analytics; AWS Certified Cloud Practitioner; AWS Certified Security – Specialty; AWS Certified Solutions Architect – Associate; AWS Certified Solutions Architect – Professional",
"current_company_industry": "IT Services and IT Consulting"
}
}
]
}
以下 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": "r98d1b462a2dd474e983cfd86fffbde99",
"source": "linkedin_people",
"meta": {
"coverage_percent": 100,
"matched": 24300,
"offset": 0,
"limit": 3
},
"documents": [
{
"bright_id": "4a2bd7ef9d05b88d53fb611c363808e740501a76ae8a654b5c3519791ff9ad0d",
"data": {
"current_title": "Senior Cloud Engineer",
"country_code": "US",
"experience_years": 5,
"certification_names": "AWS Certified Data Analytics – Specialty; AWS Certified Database – Specialty; AWS Certified DevOps Engineer – Professional; AWS Certified Developer – Associate; AWS Certified Machine Learning - Specialty; AWS Certified Solutions Architect – Associate; AWS Certified Solutions Architect – Professional; Amazon Web Services Cloud Practitioner"
}
}
]
}
view 与 query 的关系,参见 Business Search 字段视图。
更多经过测试的请求,参见 Business Search 查询示例。