Searchkit is an open source library which helps you build a great search experience with Elasticsearch.
Works with React, Vue, Angular, and more.
import Searchkit from "searchkit"
import Client from '@searchkit/instantsearch-client'
import { InstantSearch, SearchBox, Hits, RefinementList, Pagination, NumericMenu } from 'react-instantsearch-dom';
const sk = new Searchkit({
connection: {
host: 'http://localhost:9200'
},
search_settings: {
search_attributes: [{ field: 'title', weight: 3 }, 'actors', 'plot'],
result_attributes: ['title', 'actors', 'poster', 'plot'],
highlight_attributes: ['title'],
facet_attributes: [
{ attribute: 'actors', field: 'actors.keyword', type: 'string' },
{ attribute: 'imdbrating', type: 'numeric', field: 'imdbrating' }
]
}
})
const searchClient = Client(sk);
export default function Web() {
return (
<InstantSearch
indexName="imdb_movies"
searchClient={searchClient}
>
<SearchBox />
<div className="left-panel">
<RefinementList attribute="actors" searchable={true} limit={10} />
<NumericMenu
attribute="imdbrating"
items={[
{ label: '5 - 7', start: 5, end: 7 },
{ label: '7 - 9', start: 7, end: 9 },
{ label: '>= 9', start: 9 },
]}
/>
</div>
<div className="right-panel">
<Hits />
<Pagination />
</div>
</InstantSearch>
);
}
Searchkit uses instantsearch, which means you can use the instantsearch libraries to build your search experience.
Use Instantsearch Frontend Libraries with Elasticsearch.
Components for React, Vue, Angular and Javascript. Build a search UI without needing frontend skills.
Build an autocomplete experience with Autocomplete.js, which is compatible with Searchkit.
Searchkit provides a GraphQL API, which allows you to build a search experience using GraphQL.
Searchkit is built on top of Elasticsearch, which means you can use the Elasticsearch query language to build your search experience.
Customize the query before and after it is sent to Elasticsearch. Allows you to add custom filters, or change the query DSL easily.
Allows you to build your own scoring query using the Elasticsearch query language.
Support for nested fields, for data models that require joins.
Build your own Facets using Elasticsearch aggregations.
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.