Gathering detailed insights and metrics for searchkit
Gathering detailed insights and metrics for searchkit
Gathering detailed insights and metrics for searchkit
Gathering detailed insights and metrics for searchkit
React + Vue Search UI for Elasticsearch & Opensearch. Compatible with Algolia's Instantsearch and Autocomplete components.
npm install searchkit
Typescript
Module System
Node Version
NPM Version
searchkit@4.15.0
Updated on Jun 01, 2025
searchkit@4.14.1
Updated on Mar 15, 2025
searchkit@4.13.3
Updated on Mar 09, 2025
@searchkit/instantsearch-client@4.14.1
Updated on Oct 29, 2024
searchkit@4.13.2
Updated on Oct 22, 2024
searchkit@4.13.1
Updated on Oct 21, 2024
TypeScript (46.23%)
MDX (38.68%)
CSS (8.63%)
JavaScript (3.6%)
Jupyter Notebook (2.85%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
4,827 Stars
2,279 Commits
444 Forks
86 Watchers
31 Branches
66 Contributors
Updated on Jul 16, 2025
Latest Version
4.15.0
Package Id
searchkit@4.15.0
Unpacked Size
409.80 kB
Size
95.15 kB
File Count
10
NPM Version
10.8.2
Node Version
20.18.2
Published on
Jun 01, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
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
Elasticsearch is a search engine that enables fast and accurate searching of large volumes of data, but it can take a lot of time and code to build a great search experience.
Searchkit simplifies this process by providing a layer of abstraction on top of Elasticsearch. With Searchkit, you can use Instantsearch components like Searchbox, refinement filters and results (and many more!) to build a search experience, and it handles all the communication with Elasticsearch for you.
Searchkit Query Rules allow you to adjust relevance of results easily. With actions and conditions, you can create rules that will automatically adjust the search results based on the user's query or filters.
Searchkit is great for anyone who want to build a search experience quickly.
Searchkit to simplify using Elasticsearch for Search:
Or checkout our documentation for more examples.
Either install via npm or yarn
1npm install searchkit @searchkit/api @searchkit/instantsearch-client
or via CDN
1<script src="https://cdn.jsdelivr.net/npm/@searchkit/instantsearch-client@latest"></script> 2<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4"></script> 3<script src="https://cdn.jsdelivr.net/npm/searchkit@latest"></script>
Searchkit requires Elasticsearch 7.0 or higher or Opensearch 2.4 or higher.
Below we are using Docker to run Elasticsearch.
1docker pull docker.elastic.co/elasticsearch/elasticsearch:8.6.2 2docker network create elastic 3docker 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
1curl --location --request PUT 'http://localhost:9200/products' \ 2--header 'Content-Type: application/json' \ 3--data-raw '{ 4 "mappings": { 5 "properties": { 6 "name": { 7 "type": "text" 8 }, 9 "description": { 10 "type": "text" 11 }, 12 "price": { 13 "type": "integer" 14 }, 15 "categories": { 16 "type": "text", 17 "fields": { 18 "keyword": { 19 "type": "keyword" 20 } 21 } 22 } 23 } 24 } 25}' 26 27curl --location --request POST 'http://localhost:9200/products/_doc' \ 28--header 'Content-Type: application/json' \ 29--data-raw '{ 30 "name": "Apple iPhone 12 Pro Max", 31 "description": "The iPhone 12 Pro Max is the most powerful iPhone ever. It has a 6.7-inch Super Retina XDR display, a Ceramic Shield front cover, and a triple-camera system with a LiDAR scanner. It also has a 5G connection, a 6-core CPU, and a 4-core GPU. The iPhone 12 Pro Max is available in 128GB, 256GB, and 512GB storage options.", 32 "categories": ["phones", "apple"], 33 "price": 800 34}' 35 36curl --location --request POST 'http://localhost:9200/products/_doc' \ 37--header 'Content-Type: application/json' \ 38--data-raw '{ 39 "name": "Apple iPhone 12 Pro", 40 "description": "The iPhone 12 Pro is the most powerful iPhone ever. It has a 6.1-inch Super Retina XDR display, a Ceramic Shield front cover, and a triple-camera system with a LiDAR scanner. It also has a 5G connection, a 6-core CPU, and a 4-core GPU. The iPhone 12 Pro is available in 128GB, 256GB, and 512GB storage options.", 41 "categories": ["phones", "apple"], 42 "price": 700 43}'
Searchkit compatible with all Instantsearch frameworks. Below is an example using react-instantsearch.
1import Searchkit from "searchkit"
2import Client from '@searchkit/instantsearch-client'
3
4// import your InstantSearch components
5import { InstantSearch, SearchBox, Hits, RefinementList, Pagination, RangeInput } from 'react-instantsearch';
6
7const sk = new Searchkit({
8 connection: {
9 host: 'http://localhost:9200',
10 // with an apiKey
11 // https://www.searchkit.co/docs/guides/setup-elasticsearch#connecting-with-api-key
12 // apiKey: '##########'
13 // with a username/password
14 // https://www.searchkit.co/docs/guides/setup-elasticsearch#connecting-with-usernamepassword
15 //auth: {
16 // username: "elastic",
17 // password: "changeme"
18 //}
19 },
20 search_settings: {
21 search_attributes: [{ field: 'title', weight: 3 }, 'actors', 'plot'],
22 result_attributes: ['title', 'actors', 'poster', 'plot'],
23 highlight_attributes: ['title'],
24 facet_attributes: [
25 { attribute: 'actors', field: 'actors.keyword', type: 'string' },
26 { attribute: 'imdbrating', type: 'numeric', field: 'imdbrating' }
27 ]
28 }
29})
30
31const searchClient = Client(sk);
32
33const App = () => (
34 <InstantSearch
35 indexName="imdb_movies"
36 searchClient={searchClient}
37 >
38 <SearchBox />
39 <div className="left-panel">
40 <RefinementList attribute="actors" searchable={true} limit={10} />
41 <RangeInput attribute="imdbrating" />
42 </div>
43 <div className="right-panel">
44 <Hits />
45 <Pagination />
46 </div>
47 </InstantSearch>
48}
In above example, we are calling Elasticsearch directly from the browser. This is not recommended for production use. Instead, you should use the Searchkit API to proxy requests to Elasticsearch. With Searchkit, you can do this in a few lines of code.
Update the client to specify the API url
1import Searchkit from "searchkit" 2import Client from '@searchkit/instantsearch-client' 3 4// import your InstantSearch components 5import { InstantSearch, SearchBox, Hits, RefinementList, Pagination, RangeInput } from 'react-instantsearch'; 6 7const searchClient = Client({ 8 url: "/api/search", 9}); 10 11const App = () => ( 12 <InstantSearch 13 indexName="imdb_movies" 14 searchClient={searchClient} 15 > 16 <SearchBox /> 17 <div className="left-panel"> 18 <RefinementList attribute="actors" searchable={true} limit={10} /> 19 <RangeInput attribute="imdbrating" /> 20 </div> 21 <div className="right-panel"> 22 <Hits /> 23 <Pagination /> 24 </div> 25 </InstantSearch> 26}
Example below using Next.js API Routes. You can also use Cloudflare Workers or Vercel Edge Functions, or any other Node.js server.
1import Client from '@searchkit/api' 2import { NextApiRequest, NextApiResponse } from 'next' 3 4const client = Client( 5 { 6 connection: { 7 host: 'http://localhost:9200' 8 }, 9 search_settings: { 10 search_attributes: [{ field: 'title', weight: 3 }, 'actors', 'plot'], 11 result_attributes: ['title', 'actors', 'poster', 'plot'], 12 highlight_attributes: ['title'], 13 facet_attributes: [ 14 { attribute: 'actors', field: 'actors.keyword', type: 'string' }, 15 { attribute: 'imdbrating', type: 'numeric', field: 'imdbrating' } 16 ] 17 } 18 }, 19 { debug: true } 20) 21 22export default async function handler(req: NextApiRequest, res: NextApiResponse) { 23 const results = await client.handleRequest(req.body) 24 res.send(results) 25}
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".
1 2{ 3 id: '1', 4 conditions: [ 5 [ 6 { 7 context: 'query', 8 value: 'movie', 9 match_type: 'exact' 10 } 11 ] 12 ], 13 actions: [ 14 { 15 action: 'QueryBoost', 16 query: 'actors:"Dan Aykroyd" OR actors:"Charlie Sheen"', 17 weight: 2 18 }, 19 { 20 action: 'QueryFilter', 21 query: 'type:"movie"' 22 } 23 ] 24} 25
read more at Query Rules docs.
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.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
7 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
Reason
Found 13/30 approved changesets -- score normalized to 4
Reason
security policy file detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
56 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More