npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@codeparticle/strapi-plugin-es-ai-search

v1.0.4

Published

Elasticsearch integration for Strapi v5 with AI-powered vector embeddings

Readme

Strapi v5 Plugin: Elasticsearch AI Search

A powerful Strapi v5 plugin for integrating with Elasticsearch, providing automatic vector embedding generation for semantic search, multi-locale support, real-time synchronization, and hybrid search (text + vector).

Features

  • 🔍 Elasticsearch Integration: Automatically sync Strapi content to Elasticsearch indices.
  • 🤖 AI-Powered Embeddings: Generate vector embeddings for semantic search using OpenAI or custom providers.
  • Hybrid Search: Combine traditional BM25 text search with KNN vector similarity using configurable Alpha/Beta weights.
  • 🌍 Multi-locale Support: Handle localized content with locale-specific indices.
  • 🔄 Real-time Synchronization: Lifecycle hooks to keep Elasticsearch in sync with Strapi content changes.
  • 📊 Batch Operations: Efficient bulk indexing and embedding generation tools.
  • 🛠️ Migration Tools: Utilities for migrating from legacy Elastic App Search to regular Elasticsearch indices.

Usage

Install the plugin in your Strapi v5 application:

pnpm add @codeparticle/strapi-plugin-es-ai-search

Basic Configuration

Add the configuration to config/plugins.js (or config/plugins.ts):

module.exports = ({ env }) => ({
  'es-ai-search': {
    enabled: true,
    config: {
      elasticsearchUrl: env('ELASTICSEARCH_URL'),
      elasticsearchApiKey: env('ELASTICSEARCH_API_KEY'),
      indexPrefix: env('ELASTICSEARCH_INDEX_PREFIX', 'strapi'),
      
      // Embedding service for vector search
      vectorEnabled: env.bool('EMBEDDINGS_ENABLED', true),
      embeddingProvider: env('EMBEDDING_PROVIDER', 'openai'),
      embeddingModel: env('EMBEDDING_MODEL_NAME', 'text-embedding-3-small'),
      embeddingApiKey: env('EMBEDDING_API_KEY'),
      embeddingServiceUrl: env('ELASTICSEARCH_EMBEDDING_URL'),
      embeddingTimeout: env.int('EMBEDDING_TIMEOUT', 10000),
      
      // Summary/LLM API configuration
      aiApiKey: env('AI_API_KEY'),
      aiBaseUrl: env('AI_BASE_URL'),
      
      // Hybrid Search weighting
      hybridAlpha: env.float('HYBRID_ALPHA', 0.5),
      hybridBeta: env.float('HYBRID_BETA', 0.5),
      
      apisToSync: [
        {
          name: 'api::article.article',
          indexSuffix: 'article',
          populate: ['category', 'author'],
        },
      ]
    }
  }
});

AI Embedding Integration

The plugin generates vector embeddings for documents by calling the configured embedding provider.

How It Works

  1. Content Formatting: The plugin concatenates configured fields (default: title + description) into a single string.
  2. Embedding Generation: The server-side service calls the configured provider (e.g., OpenAI).
  3. Storage: The numeric vector is stored in the embedding dense_vector field in Elasticsearch.
  4. Search: When searching, the plugin generates a query vector and performs a hybrid or KNN search.

Environment Variables

# Elasticsearch
ELASTICSEARCH_URL=https://your-es-cluster:9200
ELASTICSEARCH_API_KEY=your-api-key
ELASTICSEARCH_INDEX_PREFIX=beautynexos

# Embeddings
EMBEDDINGS_ENABLED=true
EMBEDDING_PROVIDER=openai # Options: openai, legacy
EMBEDDING_MODEL_NAME=text-embedding-3-small
EMBEDDING_API_KEY=your-llm-api-key
ELASTICSEARCH_EMBEDDING_URL=https://api.openai.com/v1
EMBEDDING_TIMEOUT=10000 # milliseconds

# Summary / LLM
AI_API_KEY=your-llm-api-key
AI_BASE_URL=https://api.openai.com/v1

# Hybrid Search
HYBRID_ALPHA=0.5
HYBRID_BETA=0.5

Migration from Elastic App Search

This plugin includes utilities to migrate data from legacy Elastic App Search indices to regular Elasticsearch indices.

Running the Migration

# Dry run to preview changes
npm run migrate:appsearch-to-es:dry-run

# Execute full migration
npm run migrate:appsearch-to-es

License

MIT