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

Update Elasticsearch Analyzer to not fail when @timestamp has no mapping in searched indices #1322

Merged
merged 2 commits into from
Feb 6, 2025
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
18 changes: 17 additions & 1 deletion analyzers/Elasticsearch/elk.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,24 @@ def run(self):
info['querystring'] += '"'
#loop to get hits from each index
for index in self.index:
body = {
"sort": [
{
"@timestamp": {
"order": "desc",
"unmapped_type" : "date"
}
}
],
"query": {
"multi_match": {
"query": self.data,
"fields": self.fields
}
}
}
#search elastic for fields in each index
res = es.search(size=self.size,index=index,body={'sort':[{"@timestamp":{"order":"desc"}}],'query':{'multi_match':{'query':self.data, 'fields':self.fields}}})
res = es.search(size=self.size,index=index,body=body)
#if relation is gte then more logs exist than we will display
if res['hits']['total']['relation'] == 'gte' or res['hits']['total']['relation'] == 'gt':
total = 'gte'
Expand Down