# Elasticsearch DSL: Employee Posts API

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

Query type:

URL:
{% endcolumn %}

{% column %}
Employee Posts

Elasticsearch DSL

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

***

## Overview

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

Additionally, the endpoint allows you to operate filters that mimic our employee posts data, enabling you to write more sophisticated queries than using the `/v2/employee_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="../../../api-introduction/requests/elasticsearch-dsl">elasticsearch-dsl</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"
                    }
                }
            },
            "author_name": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword"
                    }
                }
            },
            "author_profile_url": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword"
                    }
                }
            },
            "employee_parent_id":{
                "type": "long"
            },
            "author_headline": {
                "type": "text",
                "fields": {
                    "exact": {
                        "type": "keyword"
                    }
                }
            },
            "author_posts_count": {
                "type": "long"
            },
            "date_published": {
                "type": "date",
                "format": "yyyy-MM-dd"
            },
            "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"
                            }
                        }
                    },
                    "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"
                            }
                        }
                    },
                    "employee_parent_id":{
                        "type": "long"
                    },
                    "author_headline": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword"
                            }
                        }
                    },
                    "date_published": {
                        "type": "date",
                        "format": "yyyy-MM-dd"
                    },
                    "article_body": {
                        "type": "text"
                    },
                    "image_url": {
                        "type": "text",
                        "index": false
                    },
                    "hashtags": {
                        "type": "text",
                        "fields": {
                            "exact": {
                                "type": "keyword"
                            }
                        }
                    }
                }
            }
        }
    }
}
```

{% endcode %}

</details>

## Sample request

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

```json
curl -X 'POST' \
'https://api.coresignal.com/cdapi/v2/employee_post/search/es_dsl' \
  -H 'accept: application/json' \
  -H 'apikey: {API Key}' \
  -H 'Content-Type: application/json' \
  -d '{
   "query":{
      "match":{
         "author_name":{
            "query":"John Smith",
            "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": {
            "author_name":{
                "query":"John Smith",
                "operator": "and"
            }
        }
    },
    "sort": [
        "id"
    ]
}
```

{% endcode %}
{% endtab %}

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

```json
{
    "query": {
        "match": {
            "author_name":{
                "query":"John Smith",
                "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/employee-api/employee-posts-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.
