> For the complete documentation index, see [llms.txt](https://docs.coresignal.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coresignal.com/company-api/company-posts-api/elasticsearch-dsl.md).

# Elasticsearch DSL: Company Posts API

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

Query type:

URL:
{% endcolumn %}

{% column %}
Company Posts

Elasticsearch DSL

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

***

## Overview

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

Additionally, the endpoint allows you to operate filters that mimic our company posts data, enabling you to write more sophisticated queries than using the `/v2/company_post/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="/pages/ceComGzswyKc0uD4ke5Q">/pages/ceComGzswyKc0uD4ke5Q</a></td></tr></tbody></table>

## Elasticsearch schema

<details>

<summary>Elasticsearch schema</summary>

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

```json
{
    "mappings": {
        "properties": {
            "id": {
                "type": "keyword"
            },
            "url": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword"
                    }
                }
            },
            "company_id": {
                "type": "long"
            },
            "company_source_id": {
                "type": "long"
            },
            "company_name": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword"
                    }
                }
            },
            "company_url": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword"
                    }
                }
            },
            "company_headline": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword"
                    }
                }
            },
            "date_published": {
                "type": "date",
                "format": "yyyy-MM-dd"
            },
            "created_at": {
                "type": "date",
                "format": "yyyy-MM-dd HH:mm:ss"
            },
            "article_body": {
                "type": "text"
            },
            "image_url": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword"
                    }
                }
            },
            "hashtags": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword"
                    }
                }
            },
            "mentions": {
                "type": "nested",
                "properties": {
                    "full_name": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword"
                            }
                        }
                    },
                    "url": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword"
                            }
                        }
                    }
                }
            },
            "reaction_count": {
                "type": "long"
            },
            "comment_count": {
                "type": "long"
            },
            "comments": {
                "type": "nested",
                "properties": {
                    "full_name": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword"
                            }
                        }
                    },
                    "headline": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword"
                            }
                        }
                    },
                    "follower_count": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword"
                            }
                        }
                    },
                    "profile_url": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword"
                            }
                        }
                    },
                    "body": {
                        "type": "text"
                    },
                    "reaction_count": {
                        "type": "long"
                    },
                    "date_published": {
                        "type": "date",
                        "format": "yyyy-MM-dd"
                    }
                }
            },
            "reshared_post": {
                "type": "nested",
                "properties": {
                    "id": {
                        "type": "keyword"
                    },
                    "url": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword"
                            }
                        }
                    },
                    "author_name": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword"
                            }
                        }
                    },
                    "author_profile_url": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword"
                            }
                        }
                    },
                    "author_headline": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword"
                            }
                        }
                    },
                    "article_body": {
                        "type": "text"
                    },
                    "image_url": {
                        "type": "text",
                        "index": false
                    },
                    "hashtags": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword"
                            }
                        }
                    },
                    "date_published": {
                        "type": "date",
                        "format": "yyyy-MM-dd"
                    },
                    "company_id": {
                        "type": "long"
                    }
                }
            }
        }
    }
}

```

{% endcode %}

</details>

## Sample request

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

```json
curl -X 'POST' \
'https://api.coresignal.com/cdapi/v2/company_post/search/es_dsl' \
  -H 'accept: application/json' \
  -H 'apikey: {API Key}' \
  -H 'Content-Type: application/json' \
  -d '{
   "query":{
      "match":{
         "company_name":{
            "query":"Tesla",
            "operator":"and"
         }
      }
   }
}'
```

{% endcode %}

### Sorting options

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

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

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

{% endcode %}
{% endtab %}

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

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

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.coresignal.com/company-api/company-posts-api/elasticsearch-dsl.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
