Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Trivial Bug] Adding wildcards to index to scrape entire patterns #90

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions backend/app/services/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ async def post(self, query, indice=None, size=10000, start_date=None, end_date=N
if self.prev_es:
self.prev_index = self.prev_index_prefix + (self.prev_index if indice is None else indice)
return await self.prev_es.search(
index=self.prev_index,
index=self.prev_index+"*",
body=jsonable_encoder(query),
size=size)
else:
self.new_index = self.new_index_prefix + (self.new_index if indice is None else indice)
return await self.new_es.search(
index=self.new_index,
index=self.new_index+"*",
body=jsonable_encoder(query),
size=size)
else:
Expand All @@ -76,7 +76,7 @@ async def post(self, query, indice=None, size=10000, start_date=None, end_date=N
query['query']['bool']['filter']['range'][timestamp_field]['gte'] = str(start_date)
if start_date is None:
response = await self.prev_es.search(
index=self.prev_index,
index=self.prev_index+"*",
body=jsonable_encoder(query),
size=size)
previous_results = response['hits']['hits']
Expand All @@ -95,7 +95,7 @@ async def post(self, query, indice=None, size=10000, start_date=None, end_date=N
query['query']['bool']['filter']['range'][timestamp_field]['lte'] = str(end_date)
if end_date is None:
response = await self.new_es.search(
index=self.new_index,
index=self.new_index+"*",
body=jsonable_encoder(query),
size=size)
new_results = response['hits']['hits']
Expand All @@ -109,7 +109,7 @@ async def post(self, query, indice=None, size=10000, start_date=None, end_date=N
return await self.scan_indices(self.new_es, self.new_index, query, timestamp_field, start_date, end_date, size)
else:
response = await self.new_es.search(
index=self.new_index,
index=self.new_index+"*",
body=jsonable_encoder(query),
size=size)
return response['hits']['hits']
Expand All @@ -119,13 +119,13 @@ async def post(self, query, indice=None, size=10000, start_date=None, end_date=N
if self.prev_es:
self.prev_index = self.prev_index_prefix + (self.prev_index if indice is None else indice)
response = await self.prev_es.search(
index=self.prev_index,
index=self.prev_index+"*",
body=jsonable_encoder(query),
size=size)
previous_results = response['hits']['hits']
self.new_index = self.new_index_prefix + (self.new_index if indice is None else indice)
response = await self.new_es.search(
index=self.new_index,
index=self.new_index+"*",
body=jsonable_encoder(query),
size=size)
new_results = response['hits']['hits']
Expand Down
Loading