# Elasticsearch DSL: Base Jobs API

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

Query type:

URL:
{% endcolumn %}

{% column %}
Base Jobs

Elasticsearch DSL

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

***

## Overview

Use the `/v2/job_base/search/es_dsl` endpoint for more sophisticated queries.

Additionally, the endpoint allows you to operate filters that mimic our job posting data, enabling you to write more sophisticated queries than using the `/v2/job_base/search/filter` endpoint.

<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 expandable="true" %}

```json
{
    "mappings": {
        "properties": {
            "id": {
                "type": "long"
            },
            "created": {
                "type": "date",
                "format": "yyyy-MM-dd HH:mm:ss"
            },
            "last_updated": {
                "type": "date",
                "format": "yyyy-MM-dd HH:mm:ss"
            },
            "time_posted": {
                "type": "text",
                "index": false
            },
            "title": {
                "type": "text"
            },
            "description": {
                "type": "text"
            },
            "seniority": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "employment_type": {
                "type": "text"
            },
            "location": {
                "type": "text"
            },
            "url": {
                "type": "text",
                "index": false
            },
            "hash": {
                "type": "text",
                "index": false
            },
            "company_id": {
                "type": "long"
            },
            "company_name": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "external_url": {
                "type": "text"
            },
            "company_url": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword"
                    }
                }
            },
            "deleted": {
                "type": "byte"
            },
            "application_active": {
                "type": "byte"
            },
            "salary": {
                "type": "text",
                "index": false
            },
            "applicants_count": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "professional_network_job_id": {
                "type": "long"
            },
            "country": {
                "type": "text"
            },
            "redirected_url": {
                "type": "text"
            },
            "job_industry_collection": {
                "type": "nested",
                "properties": {
                    "job_industry_list": {
                        "properties": {
                            "industry": {
                                "type": "text"
                            }
                        }
                    }
                }
            },
            "job_company_website": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    },
                    "domain_only": {
                        "type": "text"
                    }
                }
            },
            "job_functions_collection": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            }
        }
    }
}

```

{% 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/jobs/playground). Write a prompt, and AI assistant will automatically convert it into a query.
{% endhint %}

## Sample request

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

```json
curl -X 'POST' \
'https://api.coresignal.com/cdapi/v2/job_base/search/es_dsl'\
  -H 'accept: application/json' \
  -H 'apikey: {API Key}' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": {
        "match": {
            "company_name": {
                "query": "Apple",
                "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 ID" %}
{% code title="Sort by ID" %}

```json
{
    "query": {
        "match": {
            "company_name": {
                "query": "Apple",
                "operator": "and"
            }
        }
    },
    "sort": [
        "id"
    ]
}
```

{% endcode %}
{% endtab %}

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

```json
{
    "query": {
        "match": {
            "company_name": {
                "query": "Apple",
                "operator": "and"
            }
        }
    },
    "sort": [
        "_score"
    ]
}
```

{% 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/jobs-api/base-jobs-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.
