Skip to content

Commit

Permalink
Fix: Handle "query_shard_exception" in Elasticsearch error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jaegeral committed Jan 31, 2025
1 parent 79c693f commit 22f8b9a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions timesketch/frontend-ng/src/components/Explore/EventList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ limitations under the License.
<v-dialog v-model="saveSearchMenu" v-if="!disableSaveSearch" width="500">
<template v-slot:activator="{ on, attrs }">
<v-btn small depressed v-bind="attrs" v-on="on" title="Save Search">
<v-icon left small >mdi-content-save-outline</v-icon>
<v-icon left small>mdi-content-save-outline</v-icon>
Save search
</v-btn>
</template>
Expand Down Expand Up @@ -882,9 +882,13 @@ export default {
}
})
.catch((e) => {
let msg = 'Sorry, there was a problem fetching your search results. Error: "'+ e.response.data.message +'"'
if (e.response.data.message.includes('too_many_nested_clauses')) {
msg = 'Sorry, your query is too complex. Use field-specific search (like "message:(<query terms>)") and try again.'
let msg = 'Sorry, there was a problem fetching your search results. Error: "' + e.response.data.message + '"'
if (
e.response.data.message.includes('too_many_nested_clauses') ||
e.response.data.message.includes('query_shard_exception')
) {
msg =
'Sorry, your query is too complex. Use field-specific search (like "message:(<query terms>)") and try again.'
this.warningSnackBar(msg)
} else {
this.errorSnackBar(msg)
Expand Down Expand Up @@ -996,7 +1000,7 @@ export default {
}
ApiClient.saveEventAnnotation(this.sketch.id, 'label', '__ts_star', event, this.currentSearchNode)
.then((response) => {
this.$store.dispatch('updateEventLabels', { label: "__ts_star", num: count })
this.$store.dispatch('updateEventLabels', { label: '__ts_star', num: count })
})
.catch((e) => {
console.error(e)
Expand All @@ -1015,7 +1019,7 @@ export default {
})
ApiClient.saveEventAnnotation(this.sketch.id, 'label', '__ts_star', this.selectedEvents, this.currentSearchNode)
.then((response) => {
this.$store.dispatch('updateEventLabels',{ label: "__ts_star", num: netStarCountChange })
this.$store.dispatch('updateEventLabels', { label: '__ts_star', num: netStarCountChange })
this.selectedEvents = []
})
.catch((e) => {})
Expand Down

0 comments on commit 22f8b9a

Please sign in to comment.