Skip to content

Commit

Permalink
update es moudle
Browse files Browse the repository at this point in the history
  • Loading branch information
cococo2000 committed Oct 21, 2024
1 parent 01e16c7 commit e65e8a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 0 additions & 2 deletions bigvectorbench/algorithms/elasticsearch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ RUN python3 -c "from elasticsearch import Elasticsearch"
RUN mkdir -p /etc/docker \
&& echo '{"ip-masq": true, "iptables": true}' > /etc/docker/daemon.json

# Install milvus standalone by docker-compose.yml
COPY bigvectorbench/algorithms/elasticsearch/docker-compose.yml ./
# COPY bigvectorbench/algorithms/elasticsearch/.env ./
13 changes: 5 additions & 8 deletions bigvectorbench/algorithms/elasticsearch/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
from time import sleep
import numpy as np

from elasticsearch import ConnectionError, Elasticsearch
from elasticsearch.helpers import bulk
from elasticsearch import Elasticsearch

from bigvectorbench.algorithms.base.module import BaseANN
import csv

def metric_mapping(_metric: str):
"""
Expand All @@ -31,7 +29,6 @@ def metric_mapping(_metric: str):

class ElasticsearchBase(BaseANN):
"""Elasticsearch implementation"""

def __init__(self, metric: str, dim: int):
self._metric = metric
self._dim = dim
Expand All @@ -45,15 +42,16 @@ def __init__(self, metric: str, dim: int):
print("[Elasticsearch] client connected successfully!!!")
else:
print("[Elasticsearch] client connected failed!!!")

self.num_labels = 0
self.label_names = []
self.load_batch_size = 1000
self.query_batch_size = 100

self.name = f"Elasticsearch Base metric:{self._metric}"
self.search_params = None


self.index_name = ""
self.query_vector = None
self.query_topk = 0
self.query_filter = None
Expand Down Expand Up @@ -199,7 +197,7 @@ def convert_expr_to_filter(self, expr: str):
right = tokens[i + 1]
i += 4

# rangegte >=lte <=,,gt >lt <
# range, gte >=, lte <=, ,gt >, lt <
# term,=
if operator == ">=":
must_filters.append(
Expand Down Expand Up @@ -230,7 +228,6 @@ def convert_expr_to_filter(self, expr: str):
return must_filters, must_not_filters

def query(self, v, n, filter_expr=None):
filters = None
if filter_expr is not None:
must_filters, must_not_filters = self.convert_expr_to_filter(filter_expr)
else:
Expand Down

0 comments on commit e65e8a2

Please sign in to comment.