---
displayed_sidebar: servicesSidebar
---

import ParameterTypes from "@site/src/components/ParameterTypes"

# ISearchService

## Properties

<ParameterTypes parameters={[
  {
    "name": "options",
    "type": "`Record<string, unknown>`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

## Methods

#### addDocuments

`**addDocuments**(indexName, documents, type): unknown`

Used to index documents by the search engine provider

##### Parameters

<ParameterTypes parameters={[
  {
    "name": "indexName",
    "type": "`string`",
    "description": "the index name",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "documents",
    "type": "`unknown`",
    "description": "documents array to be indexed",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "type",
    "type": "`string`",
    "description": "of documents to be added (e.g: products, regions, orders, etc)",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

##### Returns

`unknown`

<ParameterTypes parameters={[
  {
    "name": "unknown",
    "type": "`unknown`",
    "optional": true,
    "defaultValue": "",
    "description": "returns response from search engine provider",
    "expandable": false,
    "children": []
  }
]} />

___

#### createIndex

`**createIndex**(indexName, options): unknown`

Used to create an index

##### Parameters

<ParameterTypes parameters={[
  {
    "name": "indexName",
    "type": "`string`",
    "description": "the index name",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "options",
    "type": "`unknown`",
    "description": "the options",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

##### Returns

`unknown`

<ParameterTypes parameters={[
  {
    "name": "unknown",
    "type": "`unknown`",
    "optional": true,
    "defaultValue": "",
    "description": "returns response from search engine provider",
    "expandable": false,
    "children": []
  }
]} />

___

#### deleteAllDocuments

`**deleteAllDocuments**(indexName): unknown`

Used to delete all documents

##### Parameters

<ParameterTypes parameters={[
  {
    "name": "indexName",
    "type": "`string`",
    "description": "the index name",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

##### Returns

`unknown`

<ParameterTypes parameters={[
  {
    "name": "unknown",
    "type": "`unknown`",
    "optional": true,
    "defaultValue": "",
    "description": "returns response from search engine provider",
    "expandable": false,
    "children": []
  }
]} />

___

#### deleteDocument

`**deleteDocument**(indexName, document_id): unknown`

Used to delete document

##### Parameters

<ParameterTypes parameters={[
  {
    "name": "indexName",
    "type": "`string`",
    "description": "the index name",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "document_id",
    "type": "`string` \\| `number`",
    "description": "the id of the document",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

##### Returns

`unknown`

<ParameterTypes parameters={[
  {
    "name": "unknown",
    "type": "`unknown`",
    "optional": true,
    "defaultValue": "",
    "description": "returns response from search engine provider",
    "expandable": false,
    "children": []
  }
]} />

___

#### getIndex

`**getIndex**(indexName): unknown`

Used to get an index

##### Parameters

<ParameterTypes parameters={[
  {
    "name": "indexName",
    "type": "`string`",
    "description": "the index name.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

##### Returns

`unknown`

<ParameterTypes parameters={[
  {
    "name": "unknown",
    "type": "`unknown`",
    "optional": true,
    "defaultValue": "",
    "description": "returns response from search engine provider",
    "expandable": false,
    "children": []
  }
]} />

___

#### replaceDocuments

`**replaceDocuments**(indexName, documents, type): unknown`

Used to replace documents

##### Parameters

<ParameterTypes parameters={[
  {
    "name": "indexName",
    "type": "`string`",
    "description": "the index name.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "documents",
    "type": "`unknown`",
    "description": "array of document objects that will replace existing documents",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "type",
    "type": "`string`",
    "description": "type of documents to be replaced (e.g: products, regions, orders, etc)",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

##### Returns

`unknown`

<ParameterTypes parameters={[
  {
    "name": "unknown",
    "type": "`unknown`",
    "optional": true,
    "defaultValue": "",
    "description": "returns response from search engine provider",
    "expandable": false,
    "children": []
  }
]} />

___

#### search

`**search**(indexName, query, options): unknown`

Used to search for a document in an index

##### Parameters

<ParameterTypes parameters={[
  {
    "name": "indexName",
    "type": "`string`",
    "description": "the index name",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "query",
    "type": "`null` \\| `string`",
    "description": "the search query",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "options",
    "type": "`unknown`",
    "description": "any options passed to the request object other than the query and indexName - additionalOptions contain any provider specific options",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

##### Returns

`unknown`

<ParameterTypes parameters={[
  {
    "name": "unknown",
    "type": "`unknown`",
    "optional": true,
    "defaultValue": "",
    "description": "returns response from search engine provider",
    "expandable": false,
    "children": []
  }
]} />

___

#### updateSettings

`**updateSettings**(indexName, settings): unknown`

Used to update the settings of an index

##### Parameters

<ParameterTypes parameters={[
  {
    "name": "indexName",
    "type": "`string`",
    "description": "the index name",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "settings",
    "type": "`unknown`",
    "description": "settings object",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

##### Returns

`unknown`

<ParameterTypes parameters={[
  {
    "name": "unknown",
    "type": "`unknown`",
    "optional": true,
    "defaultValue": "",
    "description": "returns response from search engine provider",
    "expandable": false,
    "children": []
  }
]} />
