> For the complete documentation index, see [llms.txt](https://omalab.gitbook.io/guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://omalab.gitbook.io/guide/engineering-wiki/testing/elasticsearch-mapping-config-synchronization.md).

# Elasticsearch mapping config synchronization

## Description

There is a synchronization issue between the production Elasticsearch "schema" and the test (local) environment "schema". To synchronize both "schemes", a rake task`es:dump_mapping`was created in oma-models repo.

`es:dump_mapping`rake tasks fetches specified mapping config data for a specified index from a specified host:port.

## Usage

```
cd oma-models
rake es:dump_mapping`
```

### Example target run

```
$ rake es:dump_mapping
---------------------------------------------------------------------
Elasticsearch URL: elasticsearch.omamatic.com:9200 (Y/n)

Enter index name (example: influencers_staging)
backlinks
Enter type (example: entity)
backlink_es
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3115  100  3115    0     0   4825      0 --:--:-- --:--:-- --:--:-- 13369
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   410  100   410    0     0    879      0 --:--:-- --:--:-- --:--:--  1767
---------------------------------------------------------------------
{
  "mappings": {
    "backlink_es": {
      "dynamic": "false",
      "properties": {
        "alt": {
          "type": "string",
          "analyzer": "snowball"
        },
        "anchor_text": {
...
---------------------------------------------------------------------
Mapping will be stored to backlinks_20140425100633.json
---------------------------------------------------------------------
```
