Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

searchkit

> 前端框架
Open source

React + Vue Search UI for Elasticsearch & Opensearch. Compatible with Algolia's Instantsearch and Autocomplete components.

4.9K stars0 likes1 views
WebsiteGitHub

About

React + Vue Search UI for Elasticsearch & Opensearch. Compatible with Algolia's Instantsearch and Autocomplete components.

Elasticsearch Search UI Components

Searchkit is an open source library which helps you build a great search experience with Elasticsearch. Works with Javascript, React, Vue, Angular, and more.

Website | Demos | Documentation | Discord

Searchkit provides a Search UI for Elasticsearch or Opensearch. With Searchkit, you can use Instantsearch components like Searchbox, refinement filters and results (and many more!) to build a search experience.

Searchkit is great for anyone who want to build a search experience quickly.

Searchkit simplifies Search UI with Elasticsearch:

  • UI Search Components for React, Vue, Angular, and more
  • Searchkit Node API proxies Elasticsearch requests from the browser.
  • Ability to use Elasticsearch Query DSL for advanced queries

Searchkit AI Bot

Searchkit Bot will help you understand this repository better. You can ask for code examples, installation guide, debugging help and much more.

Demos

  • Movies Search
  • Semantic Search
  • Geo Search
  • Camp Availability Search
  • Autocomplete

Quick Start Guides

  • Searchkit with Javascript
  • Searchkit with React
  • Searchkit with Vue
  • Searchkit with Angular

Tutorials

  • Searchkit with Next.js
  • Semantic Search
  • Searchkit with Availability Search

Codesandbox Examples

  • Searchkit with JS Widgets
  • Searchkit with Vue
  • Searchkit with Next.js
  • Proxy with Express.js

Code Examples (on Github)

  • Searchkit with Next.JS
  • Searchkit with Javascript
  • Searchkit with Vue

Proxy Elasticsearch Quick Starts

  • Searchkit with Next.js Functions
  • Searchkit with Cloudflare Workers
  • Searchkit with Express.js

Video Tutorials

  • Searchkit Intro Video Tutorial with Instantsearch.js
  • Searchkit Node API Video Tutorial

Or checkout our documentation for more examples.

Installation

Either install via npm or yarn

bash
npm install searchkit @searchkit/api @searchkit/instantsearch-client

or via CDN

xml
<script src="https://cdn.jsdelivr.net/npm/@searchkit/instantsearch-client@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4"></script>
<script src="https://cdn.jsdelivr.net/npm/searchkit@latest"></script>

Setup Elasticsearch

Searchkit requires Elasticsearch 7.0 or higher or Opensearch 2.4 or higher.

Below we are using Docker to run Elasticsearch.

bash
docker pull docker.elastic.co/elasticsearch/elasticsearch:8.6.2
docker network create elastic
docker run --name elasticsearch --net elastic -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e "xpack.security.enabled=false" -e http.cors.enabled=true -e "http.cors.allow-origin='*'" -e http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization -e http.cors.allow-credentials=true -e network.publish_host=localhost -e xpack.security.enabled=false docker.elastic.co/elasticsearch/elasticsearch:8.6.2

then lets add an index and some data

…

Setup Searchkit

Searchkit compatible with all Instantsearch frameworks. Below is an example using react-instantsearch.

…

follow along with the Getting Started guide.

Hide Elasticsearch from the browser

Searchkit Node API allows you to proxy requests to Elasticsearch from the browser. This is useful if you want to hide Elasticsearch from the browser, or if you want to add user permission filters to the query.

  • Searchkit with Next.js Functions
  • Searchkit with Cloudflare Workers
  • Searchkit with Express.js

Query Customisation

Searchkit has an out the box query builder, but you can also customise the query by passing a getQuery function to the apiClient.

typescript
const results = await apiClient.handleRequest(req.body, {
  getQuery: (query, search_attributes) => {
    return [
      {
        combined_fields: {
          query,
          fields: search_attributes,
        },
      },
    ];
  },
});

Semantic Query Search

Searchkit supports KNN query search. Below is an example of a KNN query search.

typescript
  const results = await client.handleRequest(req.body, {
    getKnnQuery(query, search_attributes, config) {
      return {
        field: 'dense-vector-field',
        k: 10,
        num_candidates: 100,
        // supported in latest version of Elasticsearch
        query_vector_builder: { 
          text_embedding: {
            model_id: 'cookie_model',
            model_text: query
          }
        }
      }
    }
  });

Follow along with the Semantic Search tutorial.

Advanced Customisation

You can also override the entire query with request hooks. Below is an example of a request hook that adds a rescore query to the first search request.

You can apply this at beforeSearch and afterSearch.

…

read more in the api docs here.

Query Rules

Query rules allows you to customize the behavior of the search experience. You can use query rules to boost or filter results, or to change the ranking of results, based on a set of conditions.

Below is an example of a query rule that boosts results for movies with Dan Aykroyd or Charlie Sheen, and filters results to only show movies if the query is the word "movie".

javascript

{
  id: '1',
  conditions: [
    [
      {
        context: 'query',
        value: 'movie',
        match_type: 'exact'
      }
    ]
  ],
  actions: [
    {
      action: 'QueryBoost',
      query: 'actors:"Dan Aykroyd" OR actors:"Charlie Sheen"',
      weight: 2
    },
    {
      action: 'QueryFilter',
      query: 'type:"movie"'
    }
  ]
}

read more at Query Rules docs.

NPM Packages

  • Searchkit Documentation
  • @searchkit/api Documentation
  • @searchkit/instantsearch-client Documentation

FAQ

Q: Do I need to expose Elasticsearch to the public internet?

Searchkit proxies requests to Elasticsearch.

Searchkit offers both options, either perform the search directly from the browser, or use the Searchkit API to proxy requests to Elasticsearch. Directly from the browser offers great developer experience & prototyping. Once you are ready to deploy, you can use the Searchkit API to proxy requests to Elasticsearch.

Q: Do I need to use React?

You can use React, React Native, Vue, Angular. You dont even need to use a frontend framework, you can use plain Javascript and HTML with instantsearch.js widgets.

Q: Which version of Elasticsearch is supported?

Searchkit is compatible with Elasticsearch 7.0 and above + Opensearch 2.0 and above.

Q: Do you support Android and iOS?

Potentially. Searchkit API mimics the Algolia API, so it should be possible to use the Algolia Instantsearch client with Searchkit API with a few tweaks. If you are interested in this, please let us know.

Q: Why would I use Searchkit instead of Algolia?

Elasticsearch has alot of advantages over Algolia. You might want to use Elasticsearch as a cheaper alternative to Algolia, especially if you have a large dataset. You might want to run Elasticsearch on your own infrastructure, or have greater control over the query relevance.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptalgoliaangularautocompletecomponents

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架