# Elasticsearch DSL: Clean Employee API

{% columns %}
{% column width="16.666666666666664%" %}
Data type:

Query type:

URL:
{% endcolumn %}

{% column %}
Clean Employee

Elasticsearch DSL

<https://api.coresignal.com/cdapi/v2/employee\\_clean/search/es\\_dsl>
{% endcolumn %}
{% endcolumns %}

***

## Overview

Use the `/v2/employee_clean/search/es_dsl` endpoint to find employee IDs matching your specifications.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>General Elasticsearch DSL information and usage tips</td><td><a href="../../../api-introduction/requests/elasticsearch-dsl">elasticsearch-dsl</a></td></tr></tbody></table>

## Elasticsearch schema

<details>

<summary>Elasticsearch schema</summary>

{% code title="Endpoint schema" expandable="true" %}

```json
{
    "mappings": {
        "properties": {
            "id": {
                "type": "long"
            },
            "company_id": {
                "type": "long"
            },
            "full_name": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "name_first": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "name_middle": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "name_last": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "websites_professional_network": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "description": {
                "type": "text"
            },
            "job_title": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "management_level": {
                "type": "keyword"
            },
            "department": {
                "type": "keyword"
            },
            "is_decision_maker": {
                "type": "byte"
            },
            "is_working": {
                "type": "byte"
            },
            "job_description": {
                "type": "text"
            },
            "activity": {
                "type": "nested",
                "properties": {
                    "activity_url": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "title": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "action": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "order_in_profile": {
                        "type": "integer"
                    }
                }
            },
            "organizations": {
                "type": "nested",
                "properties": {
                    "organization": {
                        "type": "text"
                    },
                    "position": {
                        "type": "text"
                    },
                    "description": {
                        "type": "text"
                    },
                    "date_from": {
                        "type": "date"
                    },
                    "date_from_year": {
                        "type": "short"
                    },
                    "date_from_month": {
                        "type": "byte"
                    },
                    "date_to": {
                        "type": "date"
                    },
                    "date_to_year": {
                        "type": "short"
                    },
                    "date_to_month": {
                        "type": "byte"
                    },
                    "order_in_profile": {
                        "type": "long"
                    }
                }
            },
            "patents": {
                "type": "nested",
                "properties": {
                    "title": {
                        "type": "text"
                    },
                    "status": {
                        "type": "text"
                    },
                    "inventors": {
                        "type": "nested",
                        "properties": {
                            "full_name": {
                                "type": "keyword"
                            },
                            "profile_url": {
                                "type": "text"
                            },
                            "order_in_profile": {
                                "type": "long"
                            }
                        }
                    },
                    "date": {
                        "type": "date"
                    },
                    "date_year": {
                        "type": "short"
                    },
                    "date_month": {
                        "type": "byte"
                    },
                    "date_day": {
                        "type": "byte"
                    },
                    "patent_url": {
                        "type": "text"
                    },
                    "description": {
                        "type": "text"
                    },
                    "patent_or_application_number": {
                        "type": "keyword"
                    },
                    "order_in_profile": {
                        "type": "long"
                    }
                }
            },
            "publications": {
                "type": "nested",
                "properties": {
                    "title": {
                        "type": "text"
                    },
                    "publisher": {
                        "type": "text"
                    },
                    "date": {
                        "type": "date"
                    },
                    "date_year": {
                        "type": "short"
                    },
                    "date_month": {
                        "type": "byte"
                    },
                    "date_day": {
                        "type": "byte"
                    },
                    "description": {
                        "type": "text"
                    },
                    "authors": {
                        "type": "nested",
                        "properties": {
                            "full_name": {
                                "type": "keyword"
                            },
                            "profile_url": {
                                "type": "text"
                            },
                            "order_in_profile": {
                                "type": "long"
                            }
                        }
                    },
                    "publication_url": {
                        "type": "text"
                    },
                    "order_in_profile": {
                        "type": "long"
                    }
                }
            },
            "awards": {
                "type": "nested",
                "properties": {
                    "title": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "issuer": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "description": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "date": {
                        "type": "date"
                    },
                    "date_year": {
                        "type": "short"
                    },
                    "date_month": {
                        "type": "byte"
                    },
                    "date_day": {
                        "type": "byte"
                    },
                    "order_in_profile": {
                        "type": "integer"
                    }
                }
            },
            "courses": {
                "type": "nested",
                "properties": {
                    "organizer": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "title": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "order_in_profile": {
                        "type": "integer"
                    }
                }
            },
            "certifications": {
                "type": "nested",
                "properties": {
                    "title": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "issuer": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "credential_id": {
                        "type": "keyword"
                    },
                    "certificate_url": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "certificate_logo_url": {
                        "type": "text",
                        "index": false
                    },
                    "date_from": {
                        "type": "date"
                    },
                    "date_from_year": {
                        "type": "short"
                    },
                    "date_from_month": {
                        "type": "byte"
                    },
                    "date_to": {
                        "type": "date"
                    },
                    "date_to_year": {
                        "type": "short"
                    },
                    "date_to_month": {
                        "type": "byte"
                    },
                    "issuer_url": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "order_in_profile": {
                        "type": "integer"
                    }
                }
            },
            "experience": {
                "type": "nested",
                "properties": {
                    "title": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "description": {
                        "type": "text"
                    },
                    "order_in_profile": {
                        "type": "integer"
                    },
                    "company_id": {
                        "type": "long"
                    },
                    "company_name": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "date_from": {
                        "type": "date"
                    },
                    "date_from_year": {
                        "type": "short"
                    },
                    "date_from_month": {
                        "type": "byte"
                    },
                    "date_to": {
                        "type": "date"
                    },
                    "date_to_year": {
                        "type": "short"
                    },
                    "date_to_month": {
                        "type": "byte"
                    },
                    "duration": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "duration_months": {
                        "type": "long"
                    },
                    "department": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "management_level": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "location": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "company_type": {
                        "type": "keyword"
                    },
                    "company_founded": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "company_followers_count": {
                        "type": "long"
                    },
                    "company_website": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            },
                            "domain_only": {
                                "type": "text"
                            }
                        }
                    },
                    "company_facebook_url": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "company_twitter_url": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "company_professional_network_url": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "company_size_range": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "company_size_employees_count": {
                        "type": "long"
                    },
                    "company_industry": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "company_location_hq_full_address": {
                        "type": "text"
                    },
                    "company_location_hq_country": {
                        "type": "keyword"
                    },
                    "company_location_hq_regions": {
                        "type": "text"
                    },
                    "company_location_hq_country_iso2": {
                        "type": "text"
                    },
                    "company_location_hq_country_iso3": {
                        "type": "text"
                    },
                    "company_location_hq_city": {
                        "type": "text"
                    },
                    "company_location_hq_state": {
                        "type": "text"
                    },
                    "company_location_hq_street": {
                        "type": "text"
                    },
                    "company_location_hq_zipcode": {
                        "type": "text"
                    },
                    "company_logo_url": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "company_last_updated": {
                        "type": "date"
                    },
                    "company_categories_and_keywords": {
                        "type": "text"
                    },
                    "company_stock_ticker": {
                        "type": "nested",
                        "properties": {
                            "exchange": {
                                "type": "text",
                                "fields": {
                                    "exact": {
                                        "type": "keyword",
                                        "null_value": "NULL"
                                    }
                                }
                            },
                            "ticker": {
                                "type": "keyword"
                            }
                        }
                    },
                    "company_is_b2b": {
                        "type": "byte"
                    },
                    "company_annual_revenue": {
                        "type": "long"
                    },
                    "company_annual_revenue_currency": {
                        "type": "text"
                    },
                    "company_employees_count_change_yearly_percentage": {
                        "type": "double"
                    },
                    "company_last_funding_round_announced_date": {
                        "type": "date"
                    },
                    "company_last_funding_round_amount_raised": {
                        "type": "long"
                    }
                }
            },
            "education": {
                "type": "nested",
                "properties": {
                    "title": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "major": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "institution_url": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            },
                            "domain_only": {
                                "type": "text"
                            }
                        }
                    },
                    "institution_logo_url": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "description": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "activities_and_societies": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "date_from": {
                        "type": "integer"
                    },
                    "date_to": {
                        "type": "integer"
                    }
                }
            },
            "languages": {
                "type": "nested",
                "properties": {
                    "language": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "proficiency": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "order_in_profile": {
                        "type": "integer"
                    }
                }
            },
            "recommendations": {
                "type": "nested",
                "properties": {
                    "recommendation": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "referee_name": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "referee_url": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "order_in_profile": {
                        "type": "integer"
                    }
                }
            },
            "recommendations_count": {
                "type": "integer"
            },
            "connections_count": {
                "type": "integer"
            },
            "location_raw_address": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "location_country": {
                "type": "keyword"
            },
            "location_regions": {
                "type": "keyword"
            },
            "last_updated": {
                "type": "date"
            },
            "is_deleted": {
                "type": "byte"
            },
            "is_hidden": {
                "type": "byte"
            },
            "follower_count": {
                "type": "long"
            },
            "skills": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "shorthand_names": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "headline": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "generated_headline": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "picture_url": {
                "type": "text"
            },
            "public_profile_id": {
                "type": "long"
            },
            "total_experience_duration": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "total_experience_duration_months": {
                "type": "long"
            },
            "location_city": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "location_state": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "location_country_iso_2": {
                "type": "keyword"
            },
            "location_country_iso_3": {
                "type": "keyword"
            }
        }
    }
}

```

{% endcode %}

</details>

{% hint style="success" %}

#### Having trouble writing Elasticsearch queries on your own?

Explore **AI query builder** feature available in Self-service [playground](https://dashboard.coresignal.com/apis/employees/playground). Write a prompt, and AI assistant will automatically convert it into a query.
{% endhint %}

### Possible input values

You can look for available input values in the general [Elasticsearch DSL](https://docs.coresignal.com/api-introduction/requests/elasticsearch-dsl#possible-input-values) topic and find the lists of the following fields:

* management\_level
* company\_industry
* location\_regions
* department

## Sample request

{% code title="Request example" expandable="true" %}

```json
curl -X 'POST' \
'https://api.coresignal.com/cdapi/v2/employee_clean/search/es_dsl' \
  -H 'accept: application/json' \
  -H 'apikey: {API Key}' \
  -H 'Content-Type: application/json' \
  -d '{
   "query": {
      "bool": {
         "should": [
            {
               "query_string": {
                  "query": "Python",
                  "default_field": "description",
                  "default_operator": "and"
               }
            },
            {
               "query_string": {
                  "query": "Python",
                  "default_field": "job_title",
                  "default_operator": "and"
               }
            },
            {
               "nested": {
                  "path": "experience",
                  "query": {
                     "bool": {
                        "should": [
                           {
                              "query_string": {
                                 "query": "Python",
                                 "default_field": "experience.description",
                                 "default_operator": "and"
                              }
                           },
                           {
                              "query_string": {
                                 "query": "Python",
                                 "default_field": "experience.title",
                                 "default_operator": "and"
                              }
                           }
                        ]
                     }
                  }
               }
            }
         ]
      }
   }
}'
```

{% endcode %}

### Sorting options

Find several examples of the available sorting options. All information about the sorting is in the general [Elasticsearch DSL](https://docs.coresignal.com/api-introduction/requests/elasticsearch-dsl#sorting-options) topic.

{% tabs %}
{% tab title="Sort by score" %}
{% code title="Sort by score" %}

```json
{
   "query":{
      "match":{
         "full_name":{
            "query":"John Smith",
            "operator":"and"
         }
      }
   },
  "sort": [
    "_score"
  ]
}
```

{% endcode %}
{% endtab %}

{% tab title="Sort by ID" %}
{% code title="Sort by ID" %}

```json
{
   "query":{
      "match":{
         "name":{
            "query":"John Smith",
            "operator":"and"
         }
      }
   },
  "sort": [
    "id"
  ]
}
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coresignal.com/employee-api/clean-employee-api/endpoints/elasticsearch-dsl.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
