Building End-to-End Semantic Search with Easysearch, Alibaba Cloud, and Ollama Embedding APIs

In the era of AI-driven search, semantic understanding has become essential for enterprise applications. Easysearch, a high-performance alternative to Elasticsearch, supports seamless integration with external embedding services—including Alibaba Cloud DashScope and locally hosted Ollama—via OpenAI-compatible APIs. This enables robust, end-to-end seamntic search systems with flexible deployment options.

Why Easysearch?

Developed by INFINI Labs, Easysearch offers:

  • Full compatibility with Elasticsearch 7.x APIs and common 8.x operations
  • Built-in kNN vector search, semantic retrieval, and hybrid query support
  • Native ingest and search pipelines for AI model integration
  • Support for on-premises deployment and data sovereignty
  • High throughput, low latency, and horizontal scalability

Its text_embedding and semantic_query_enricher processors allow direct integration with external embedding endpoints without code changes.

Supported Embedding Services

Easysearch integrates any service that adheres to the OpenAI Embedding API specification (/v1/embeddings), including:

Type Examples Protocol Deployment Key Benefit
Cloud SaaS Alibaba Cloud DashScope OpenAI-compatible Cloud Managed, high availability
OpenAI text-embedding-3 OpenAI-native Cloud
Local/Private Ollama (e.g., nomic-embed-text) Custom REST On-prem Data privacy
Self-hosted BGE/M3E models OpenAI-compatible On-prem Customizable

Integration requires only the endpoint URL and authentication token. Multiple models can coexist for A/B testing or workload routing.

Workflow Overview

The system operates in two phases:

  1. Ingestion: Text documents pass through an ingest pipeline that calls the embedding API and stores the resulting vector in a knn_dense_float_vector field.
  2. Querying: Search requests go through a search pipeline that converts the query text into a vector using the same (or different) model, then performs appproximate nearest neighbor search.

All external calls conform to OpenAI’s request/resposne format, minimizing integration effort.

Integrating Alibaba Cloud DashScope

DashScope’s text-embedding-v4 model outputs 256-dimensional vectors optimized for Chinese semantics.

1. Create Ingest Pipeline

PUT _ingest/pipeline/dashscope-embed-pipeline
{
  "processors": [
    {
      "text_embedding": {
        "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/embeddings",
        "vendor": "openai",
        "api_key": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "text_field": "content",
        "vector_field": "embedding_vec",
        "model_id": "text-embedding-v4",
        "dims": 256,
        "batch_size": 5
      }
    }
  ]
}

2. Define Index Mapping

PUT /poetry_index
{
  "mappings": {
    "properties": {
      "content": { "type": "text" },
      "embedding_vec": {
        "type": "knn_dense_float_vector",
        "knn": {
          "dims": 256,
          "model": "lsh",
          "similarity": "cosine"
        }
      }
    }
  }
}

3. Ingest Documents

POST /_bulk?pipeline=dashscope-embed-pipeline
{ "index": { "_index": "poetry_index" } }
{ "content": "风急天高猿啸哀,渚清沙白鸟飞回..." }

4. Configure Search Pipeline

PUT /_search/pipeline/dashscope-search-pipe
{
  "request_processors": [
    {
      "semantic_query_enricher": {
        "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/embeddings",
        "vendor": "openai",
        "api_key": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "default_model_id": "text-embedding-v4",
        "vector_field_model_id": {
          "embedding_vec": "text-embedding-v4"
        }
      }
    }
  ]
}

5. Assign Pipeline to Index

PUT /poetry_index/_settings
{
  "index.search.default_pipeline": "dashscope-search-pipe"
}

6. Execute Semantic Search

GET /poetry_index/_search
{
  "query": {
    "semantic": {
      "embedding_vec": {
        "query_text": "描写秋天的诗句",
        "candidates": 10
      }
    }
  }
}

Integrating Local Ollama Service

For private deployments, Ollama runs open-source embedders like nomic-embed-text.

1. Start Ollama

ollama serve
ollama pull nomic-embed-text:latest

2. Ingest Pipeline for Ollama

PUT _ingest/pipeline/ollama-embed-pipe
{
  "processors": [
    {
      "text_embedding": {
        "url": "http://localhost:11434/api/embed",
        "vendor": "ollama",
        "text_field": "content",
        "vector_field": "embedding_vec",
        "model_id": "nomic-embed-text:latest"
      }
    }
  ]
}

3. Search Pipeline for Ollama

PUT /_search/pipeline/ollama-search-pipe
{
  "request_processors": [
    {
      "semantic_query_enricher": {
        "url": "http://localhost:11434/api/embed",
        "vendor": "ollama",
        "default_model_id": "nomic-embed-text:latest",
        "vector_field_model_id": {
          "embedding_vec": "nomic-embed-text:latest"
        }
      }
    }
  ]
}

Index creation, data ingestion, and querying follow the same pattern as the DashScope example.

Security Considerations

Easysearch enforces security best practices:

  • API keys are masked in responses (e.g., TfUmLjPg...infinilabs)
  • Integration with secret managers like HashiCorp Vault
  • Support for TLS, RBAC, and audit logging

Conclusion

Easysearch’s pipeline architecture enables plug-and-play integration with both cloud-based (Alibaba Cloud) and on-premises (Ollama) embedding services. This flexibility supports diverse requirements—from high-scale public cloud deployments to air-gapped private environments—while maintaining consistent semantic search capabilities.

Tags: Easysearch semantic-search embedding-api Alibaba-Cloud-DashScope Ollama

Posted on Tue, 21 Jul 2026 17:02:08 +0000 by wes007