Easysearch vs Elasticsearch Vector Search: Compatibility Explained in One Guide
The article compares Easysearch and Elasticsearch vector‑search capabilities, showing that both support vector queries but use different field types and DSL structures, and it outlines migration pitfalls and practical advice for choosing the right system.
Conclusion
Easysearch supports vector search but its API is not compatible with Elasticsearch 8.x vector API; they use different field types and query DSL.
Core Differences
Field type: Easysearch uses knn_dense_float_vector / knn_sparse_bool_vector; Elasticsearch uses dense_vector, sparse_vector, semantic_text.
Query entry: Easysearch uses query.knn_nearest_neighbors; Elasticsearch uses top‑level knn, retriever.knn or script_score.
Vector parameter name: Easysearch uses vec.values; Elasticsearch uses query_vector.
Approx/Exact control: Easysearch sets model: lsh / exact; Elasticsearch relies on approximate kNN or custom script_score.
Candidate parameter: Easysearch uses candidates; Elasticsearch uses num_candidates.
Compatibility: Easysearch ❌ not compatible with ES 8.x vector API; Elasticsearch ✅ native.
DSL Comparison
Easysearch
Index creation example:
PUT /my-vectors
{
"mappings": {
"properties": {
"embedding": {
"type": "knn_dense_float_vector",
"knn": {
"dims": 4,
"model": "lsh",
"similarity": "cosine",
"L": 99,
"k": 1
}
}
}
}
}Search example:
POST /my-vectors/_search
{
"size": 10,
"query": {
"knn_nearest_neighbors": {
"field": "embedding",
"vec": {
"values": [0.10, -0.02, 0.87, 0.40]
},
"model": "lsh",
"similarity": "cosine",
"candidates": 100
}
}
}Elasticsearch
Index creation example:
PUT /amazon-reviews
{
"mappings": {
"properties": {
"review_vector": {
"type": "dense_vector",
"dims": 4,
"index": true,
"similarity": "cosine"
}
}
}
}Search example:
POST /amazon-reviews/_search
{
"knn": {
"field": "review_vector",
"query_vector": [0.1, 0.2, 0.29, 0.41],
"k": 2,
"num_candidates": 5
}
}Exact Search Differences
Easysearch switches the model to exact while keeping the same query entry:
{
"query": {
"knn_nearest_neighbors": {
"field": "my_vec",
"vec": { "values": [0.1,0.2,0.3,0.4] },
"model": "exact",
"similarity": "cosine"
}
}
}Elasticsearch uses a script_score query with a custom script:
{
"query": {
"script_score": {
"query": { "match_all": {} },
"script": {
"source": "cosineSimilarity(params.queryVector, 'product-vector') + 1.0",
"params": { "queryVector": [0.1,0.2,0.3,0.4] }
}
}
}
}Common Migration Pitfalls
Copying a dense_vector field directly to Easysearch causes an error; Easysearch expects knn_dense_float_vector.
Sending Elasticsearch top‑level knn query to Easysearch fails because the query tree structure differs.
Assuming functional compatibility equals API compatibility; the DSL must be rewritten, not just parameter names.
Attempting performance tuning before a minimal demo works; first verify the full index‑write‑search flow with a 4‑dim dummy dataset.
Selection Advice
If you heavily depend on the ES 8.x vector ecosystem (dense_vector, knn, semantic_text), migrating to Easysearch is a full DSL rewrite and requires careful evaluation.
For new projects willing to follow documentation, Easysearch’s docs are straightforward and can be followed without hitting the above pitfalls.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Mingyi World Elasticsearch
The leading WeChat public account for Elasticsearch fundamentals, advanced topics, and hands‑on practice. Join us to dive deep into the ELK Stack (Elasticsearch, Logstash, Kibana, Beats).
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
