class_docstr: Sparse index using Elasticsearch. It is used to index text and run queries based on BM25 similarity.
  An Elasticsearch server needs to be accessible, and a python client is declared with
  ```
  es_client = Elasticsearch([{'host': 'localhost', 'port': '9200'}])
  ```
  for example.
class_docstr_tok: ["Sparse","index","using","Elasticsearch",".","It","is","used","to","index","text","and","run","queries","based","on","BM25","similarity",".","An","Elasticsearch","server","needs","to","be","accessible",",","and","a","python","client","is","declared","with","``","`","es_client","=","Elasticsearch","(","[","{","'host","'",":","'localhost","'",",","'port","'",":","'9200","'","}","]",")","``","`","for","example","."]
docstr: Find the nearest examples indices to the query.
  
  Args:
      query (`str`): The query as a string.
      k (`int`): The number of examples to retrieve.
  
  Ouput:
      scores (`List[List[float]`): The retrieval scores of the retrieved examples.
      indices (`List[List[int]]`): The indices of the retrieved examples.
docstr_tok: ["Find","the","nearest","examples","indices","to","the","query",".","Args",":","query","(","`","str","`",")",":","The","query","as","a","string",".","k","(","`","int","`",")",":","The","number","of","examples","to","retrieve",".","Ouput",":","scores","(","`","List","[","List","[","float","]","`",")",":","The","retrieval","scores","of","the","retrieved","examples",".","indices","(","`","List","[","List","[","int","]","]","`",")",":","The","indices","of","the","retrieved","examples","."]
code: def search(self, query: str, k=10, **kwargs) -> SearchResults:
      """Find the nearest examples indices to the query.
  
      Args:
          query (`str`): The query as a string.
          k (`int`): The number of examples to retrieve.
  
      Ouput:
          scores (`List[List[float]`): The retrieval scores of the retrieved examples.
          indices (`List[List[int]]`): The indices of the retrieved examples.
      """
      response = self.es_client.search(
          index=self.es_index_name,
          body={
              "query": {
                  "multi_match": {
                      "query": query,
                      "fields": ["text"],
                      "type": "cross_fields",
                  }
              },
              "size": k,
          },
          **kwargs,
      )
      hits = response["hits"]["hits"]
      return SearchResults(
          [hit["_score"] for hit in hits],
          [int(hit["_id"]) for hit in hits],
      )
  
imports: import importlib.util
  import os
  import tempfile
  from pathlib import PurePath
  from typing import TYPE_CHECKING, Dict, List, NamedTuple, Optional, Union
  import fsspec
  import numpy
  from .utils import logging
  from .utils import tqdm
label_desc: Use image node_id 3 for calling the ElasticSearchIndex obj's underlying member method code with example usage: obj.search(query, k) and returns: SearchResults