# Elasticsearch DSL: Clean Company API

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

Query type:&#x20;

URL:
{% endcolumn %}

{% column %}
Clean Company

Elasticsearch DSL

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

***

## Overview

Use the `/v2/company_clean/search/es_dsl` endpoint to find company data 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 expandable="true" %}

```json
{
    "mappings": {
        "properties": {
            "id": {
                "type": "long"
            },
            "name": {
                "type": "text"
            },
            "type": {
                "type": "keyword",
                "null_value": "NULL"
            },
            "founded": {
                "type": "keyword"
            },
            "followers": {
                "type": "long",
                "null_value": -1
            },
            "websites_main_original": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    },
                    "domain_only": {
                        "type": "text"
                    }
                }
            },
            "websites_main": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    },
                    "domain_only": {
                        "type": "text"
                    }
                }
            },
            "websites_resolved": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    },
                    "domain_only": {
                        "type": "text"
                    }
                }
            },
            "websites_facebook": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "websites_twitter": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "websites_professional_network": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "websites_professional_network_canonical": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "size_range": {
                "type": "keyword",
                "null_value": "NULL"
            },
            "size_employees_count": {
                "type": "long",
                "null_value": -1
            },
            "size_employees_count_inferred": {
                "type": "long",
                "null_value": -1
            },
            "industry": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "description": {
                "type": "text"
            },
            "location_hq_raw_address": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "location_hq_country": {
                "type": "keyword",
                "null_value": "NULL"
            },
            "location_hq_country_iso_2": {
                "type": "keyword",
                "null_value": "NULL"
            },
            "location_hq_country_iso_3": {
                "type": "keyword",
                "null_value": "NULL"
            },
            "location_hq_state": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "location_hq_city": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "location_hq_regions": {
                "type": "text"
            },
            "last_updated": {
                "type": "date",
                "format": "yyyy-MM-dd"
            },
            "logo": {
                "type": "binary"
            },
            "specialities": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword"
                    }
                }
            },
            "ticker": {
                "type": "keyword"
            },
            "exchange": {
                "type": "keyword"
            },
            "enriched_summary": {
                "type": "text"
            },
            "enriched_keywords": {
                "type": "keyword"
            },
            "enriched_b2b": {
                "type": "long"
            },
            "enriched_category": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword",
                        "null_value": "NULL"
                    }
                }
            },
            "metadata_title": {
                "type": "text"
            },
            "metadata_description": {
                "type": "text"
            },
            "professional_network_source_id": {
                "type": "keyword"
            },
            "funding_rounds": {
                "type": "nested",
                "properties": {
                    "last_round_investors_count": {
                        "type": "long",
                        "null_value": -1
                    },
                    "total_rounds_count": {
                        "type": "long",
                        "null_value": -1
                    },
                    "last_round_type": {
                        "type": "keyword",
                        "null_value": "NULL"
                    },
                    "last_round_date": {
                        "type": "date",
                        "format": "yyyy-MM-dd"
                    },
                    "last_round_money_raised": {
                        "type": "long",
                        "null_value": -1
                    },
                    "financial_website_url": {
                        "type": "keyword"
                    }
                }
            },
            "expired_domain": {
                "type": "boolean"
            },
            "unique_domain": {
                "type": "boolean"
            },
            "unique_website": {
                "type": "boolean"
            },
            "phone_numbers": {
                "type": "keyword"
            },
            "emails": {
                "type": "text"
            },
            "pricing_available": {
                "type": "boolean"
            },
            "free_trial_available": {
                "type": "boolean"
            },
            "demo_available": {
                "type": "boolean"
            },
            "is_downloadable": {
                "type": "boolean"
            },
            "mobile_apps_exist": {
                "type": "boolean"
            },
            "online_reviews_exist": {
                "type": "boolean"
            },
            "api_docs_exist": {
                "type": "boolean"
            },
            "social_discord_urls": {
                "type": "text"
            },
            "social_facebook_urls": {
                "type": "text"
            },
            "social_instagram_urls": {
                "type": "text"
            },
            "social_professional_network_urls": {
                "type": "text"
            },
            "social_pinterest_urls": {
                "type": "text"
            },
            "social_tiktok_urls": {
                "type": "text"
            },
            "social_twitter_urls": {
                "type": "text"
            },
            "social_x_urls": {
                "type": "text"
            },
            "social_youtube_urls": {
                "type": "text"
            },
            "social_github_urls": {
                "type": "text"
            },
            "social_reddit_urls": {
                "type": "text"
            },
            "locations_full": {
                "type": "nested",
                "properties": {
                    "location_address": {
                        "type": "keyword",
                        "null_value": "NULL"
                    },
                    "is_primary": {
                        "type": "boolean"
                    },
                    "country": {
                        "type": "keyword",
                        "null_value": "NULL"
                    },
                    "country_iso_2": {
                        "type": "keyword",
                        "null_value": "NULL"
                    },
                    "country_iso_3": {
                        "type": "keyword",
                        "null_value": "NULL"
                    },
                    "regions": {
                        "type": "nested",
                        "properties": {
                            "region": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "state": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    },
                    "city": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword",
                                "null_value": "NULL"
                            }
                        }
                    }
                }
            },
            "technologies": {
                "type": "nested",
                "properties": {
                    "technology": {
                        "type": "text"
                    },
                    "first_verified_at": {
                        "type": "date",
                        "format": "yyyy-MM-dd"
                    },
                    "last_verified_at": {
                        "type": "date",
                        "format": "yyyy-MM-dd"
                    }
                }
            },
            "updates": {
                "type": "nested",
                "properties": {
                    "urn": {
                        "type": "text"
                    },
                    "followers": {
                        "type": "long"
                    },
                    "date": {
                        "type": "text"
                    },
                    "description": {
                        "type": "text"
                    },
                    "reactions_count": {
                        "type": "long"
                    },
                    "comments_count": {
                        "type": "long"
                    },
                    "reshared_post_author": {
                        "type": "text"
                    },
                    "reshared_post_author_url": {
                        "type": "text"
                    },
                    "reshared_post_author_headline": {
                        "type": "text"
                    },
                    "reshared_post_description": {
                        "type": "text"
                    },
                    "reshared_post_date": {
                        "type": "text"
                    },
                    "reshared_post_followers": {
                        "type": "long"
                    }
                }
            },
            "created_at": {
                "type": "date",
                "format": "yyyy-MM-dd"
            }
        }
    }
}

```

{% 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/company/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:

* type&#x20;
* size\_range&#x20;
* industry
* location\_hq\_regions
* last\_round\_type

### 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": {
      "bool": {
         "must": [
            {
               "query_string": {
                  "query": "2023",
                  "default_field": "founded",
                  "default_operator": "and"
               }
            }
         ]
      }
   },
      "sort": [
      "_score"
   ]
}
```

{% endcode %}
{% endtab %}

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

```json
{
   "query": {
      "bool": {
         "must": [
            {
               "query_string": {
                  "query": "2023",
                  "default_field": "founded",
                  "default_operator": "and"
               }
            }
         ]
      }
   },
      "sort": [
      "id"
   ]
}
```

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

#### Additional sorting fields

Clean Company includes **additional numerical sorting options**. Sorting is made in descending order by a selected field. If several fields have the same value, sorting is made by the `last_updated` field. If the `last_updated` values are also the same, sorting is then done by the `id` field. Sorting fields are listed below:

* `followers`,
* `size_employees_count`
