Search Examples

Request modification with compromise

Example to use compromise package to apply a price range filter if query contains price. For example, if query is mobiles under 10k then it extracts the price value as 10000 and applies a price filter to the request.

Authorization with crypto-js

The following example uses the crypto-js package to authenticate a request using HmacSHA264.

Response modification

The following example removes the _shards property from the search response of each query.

Sync call using fetch

An example, to use the data muse API to correct the misspelled words in a search query.

Async call using fetch

Example to use a third party API to save search requests.

Index Examples

Modify an Indexing request

The following example adds a calculated field to the Elasticsearch indexing requests.

Modify a bulk request

An example, to modify the Elasticsearch bulk request to add a new field to index requests.

Cron Examples

Add a new doc into index every minute

An example, to add a new doc into an index test-v2 every minute.