Global

Methods

addGlobalFilter(field, value)

Description:
  • Add custom fetch DSL middleware with simple term filter for all instances.
Source:
Example
import { addGlobalFilter } from '@ecomplus/search-engine'
addGlobalFilter('channel_id', 123)
Parameters:
Name Type Description
field string Item field to filter with dot notation
value string | number | boolean Searched field value

setSalesChannel(channelId)

Description:
  • Set channel ID for searches in all instances.
Source:
Example
import { setSalesChannel } from '@ecomplus/search-engine'
setSalesChannel(123)
Parameters:
Name Type Description
channelId number Sales channel ID

setWarehouse(warehouseCode)

Description:
  • Set warehouse (multi CD) code for searches in all instances.
Source:
Example
import { setWarehouse } from '@ecomplus/search-engine'
setWarehouse('MG')
Parameters:
Name Type Description
warehouseCode string Warehouse code

Type Definitions

aggregation

Source:
Properties:
Name Type Description
key string Brand/category/option name
doc_count number How many items match with the respective key
Type:
  • object

result

Source:
Properties:
Name Type Description
hits object Elasticsearch hits object
Properties
Name Type Description
total number Total number of products found
hits array.<object> List of resultant items
aggregations object Elasticsearch aggregations results
suggest object Search term suggestions object
took number Request time in milliseconds
Type:
  • object

spec

Source:
Properties:
Name Type Description
key string Specification grid ID
doc_count number How many items has the respective grid
options array.<aggregation> List of matched grid options
Type:
  • object

suggest

Source:
Properties:
Name Type Description
text string The original keyword from search term
offset number Position where the keyword starts on search term
length number Original keyword length
options array.<suggestion> Suggested options to replace original keyword
Type:
  • object

suggestion

Source:
Properties:
Name Type Description
text string The suggested keyword
score number Match score up to 1
freq number How many items match with the suggested keyword
Type:
  • object