# Migrate from Elasticsearch or OpenSearch

WarpSearch serves Elasticsearch- and OpenSearch-compatible REST APIs, so most applications move by changing the base
URL and the credential. This page walks through a move: check what your application uses, connect, load the data,
and trial it. The [Elasticsearch](compat-elasticsearch.md) and [OpenSearch](compat-opensearch.md) pages have the
full reference.

## 1. Pre-flight check

Before you copy any data, check whether your application depends on something WarpSearch does not support:

| Feature | On WarpSearch |
|---|---|
| Kibana, OpenSearch Dashboards | Unsupported. Grafana data sources work; an ES\|QL subset is served at `/compat/es/_query` |
| Nested and parent/child documents | See [nested document behavior and REST API limitations](schemas-and-fields.md#nested-documents). Elasticsearch `join` fields remain unsupported |
| Scripts (Painless), `runtime_mappings`, `script_fields` | **Not supported** |
| Paging | Field-sort `search_after`, native cursors, Solr `cursorMark` and emulated scroll work. No point-in-time snapshot or slices. See [Paging](searching.md#paging) |
| Index resolution | Index lists, patterns, exclusions and `_all` work. No index aliases. Data streams map to one collection without rollover |
| Index templates and ILM | Setup calls are acknowledged but definitions are not stored or applied. Snapshots remain unsupported |
| Partial updates and query-based writes | Native PATCH, `_update` and bulk partial updates work with concurrency restrictions. Update/delete by query, `_reindex` and ingest pipelines remain unsupported |
| Dynamic mapping | Supported on Elasticsearch/OpenSearch-created collections, including strict/disabled modes and dynamic templates. Native schemas still require field definitions or suffixes |
| Aggregations | Pipeline aggregations work; composite, significant terms and rare terms have availability and input restrictions. See [Aggregations](compat-elasticsearch.md#aggregations) |
| `semantic`, `sparse_vector`, `neural` and `neural_sparse` queries | **Not supported.** Compute embeddings in your application and send the vectors |
| HTTP Basic authentication | Key as password with username `apikey` or empty; arbitrary usernames are rejected |
| Relevance scores | **Not identical.** Analysis differences and documented approximations can change matching documents, scores and ranking |

Full lists: [Elasticsearch, not supported](compat-elasticsearch.md#not-supported) and
[OpenSearch, not supported](compat-opensearch.md#not-supported).

Also check your mappings. `join`, `flattened`, `completion`, `binary` and `ip_range` are rejected.
Field aliases and numeric/date range mappings work. For nested fields, see the
[REST API limitations](schemas-and-fields.md#nested-documents). Field names with `@` or `.` are mapped for you (`@timestamp` is stored as `timestamp`), and you keep
using your own names in queries and responses. See [Mappings](compat-elasticsearch.md#mappings).

## 2. Connect your client

Create an API key in the [management console](/console/). Send it as `Authorization: Bearer`,
`Authorization: ApiKey` or `X-API-Key`.

| Product | Base URL |
|---|---|
| Elasticsearch clients | `https://api.warpsearch.io/compat/es` |
| OpenSearch clients | `https://api.warpsearch.io/compat/opensearch` |

```diff
- es = Elasticsearch("https://my-cluster.example.com:9200", basic_auth=("user", "pass"))
+ es = Elasticsearch("https://api.warpsearch.io/compat/es", api_key="ws_...")
```

```python
from opensearchpy import OpenSearch

client = OpenSearch(
    hosts=[{"host": "api.warpsearch.io", "port": 443, "url_prefix": "compat/opensearch"}],
    use_ssl=True,
    headers={"Authorization": "Bearer ws_..."},
)
```

Settings for every official client, Logstash, Beats, Fluent Bit, Vector and Grafana are in the
[Elasticsearch](compat-elasticsearch.md#base-url) and [OpenSearch](compat-opensearch.md#connect) tables. The Java
API client sends `typed_keys=true`, which WarpSearch does not honor, so use the low-level REST client or raw JSON for
aggregations.

## 3. Replay your queries

Create an index with your mapping and a sample of your data, then run a day of production queries, or your test
suite, against it. Log every `Warning: 299` header (an approximation that still answered) and every
`400 unsupported_feature`. That list is your migration work.

## 4. Load your data

There is no `_reindex` from another cluster. Read from your current cluster as you do today (scroll, a snapshot
reader, or your source database) and write into WarpSearch through `_bulk`.

1. **Create the index first,** with your mapping and analysis settings: `PUT /{index}` on the compatible endpoint.
   Explicit mappings avoid unwanted inference; dynamic mapping is also supported.
2. **Bulk load.** Keep your document ids. Include your existing vectors; WarpSearch does not create embeddings.
3. **Refresh and force merge** after a large load. `_forcemerge` (editor role) also builds the approximate vector
   indexes.

```python
from elasticsearch import Elasticsearch, helpers

source = Elasticsearch("https://my-cluster.example.com:9200", basic_auth=("user", "pass"))
warp = Elasticsearch("https://api.warpsearch.io/compat/es", api_key="ws_...")

mapping = source.indices.get_mapping(index="books")["books"]["mappings"]
warp.indices.create(index="books", mappings=mapping)

actions = (
    {"_index": "books", "_id": hit["_id"], "_source": hit["_source"]}
    for hit in helpers.scan(source, index="books", query={"query": {"match_all": {}}})
)
for ok, item in helpers.streaming_bulk(warp, actions, chunk_size=1000, max_retries=5, raise_on_error=False):
    if not ok:
        print(item)

warp.indices.refresh(index="books")
warp.indices.forcemerge(index="books")
```

`helpers.scan` uses scroll on your current cluster, which supports it; WarpSearch only receives `_bulk` requests.
How `_bulk` behaves:

- Overload is reported per item as `429`, so clients can retry just those items.
- `create` checks for an existing id and returns `409` when found; concurrent creates can race.
- Atomic version/sequence-number concurrency is unsupported; partial updates reject `if_seq_no`.
- Without `refresh`, visibility depends on the collection’s default durability and commit interval.

See [Write semantics](compat-elasticsearch.md#write-semantics). Shippers such as Logstash and Beats can also write
through `_bulk`; turn off their index template, ILM and ingest pipeline steps and create the collection yourself.

## 5. Trial checklist

1. **Unsupported features:** the replay in step 3 shows no `400 unsupported_feature`, or each one has a workaround.
2. **Warnings reviewed:** every `Warning: 299` from the replay is acceptable for your application.
3. **Counts match:** `_count` on each index matches your current cluster after the load.
4. **Results compared:** send the same queries to both and compare top results by rank order, not by `_score`.
5. **Responses parse:** `_source` dates come back as epoch milliseconds and multi-valued fields as lists; there is
   no `_shards`, `_version` or `_seq_no`. See [Behavior differences](compat-elasticsearch.md#behavior-differences).
6. **Paging works** with `from`/`size` within the result window or supported field-sort `search_after`.
   Emulated scroll does not pin a snapshot; test paging while writes occur. See [Limits and errors](limits-and-errors.md).
7. **Idle collections handled:** a collection that has been idle can answer `503 warming_up` with a `Retry-After`
   header while it loads. Retry on that code, or use keep-warm. See
   [Idle collections and cold starts](collections.md#idle-collections-and-cold-starts).
8. **Writes in parallel:** send writes to both systems while you compare, then turn the old cluster off when you are
   satisfied.

For Solr, see [Moving from Elasticsearch, OpenSearch or Solr](query-languages.md#moving-from-elasticsearch-opensearch-or-solr)
and the [Solr](compat-solr.md) page.
