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

Backend: Fix Lucene logs so it only uses date_histogram #277

Merged
merged 2 commits into from
Oct 6, 2023

Conversation

fridgepoet
Copy link
Member

What this PR does / why we need it:
We discovered that in the frontend, Lucene logs queries were built only with date_histogram grouping by default time field, no matter what is chosen in the UI.
This fixes the backend to do the same. (This should only affect queries executed in Explore as of v2.10.0.

Which issue(s) this PR fixes:

Contributes to #199

Comment on lines +10 to +16
"field": "agent.keyword",
"id": "2",
"settings": {
"interval": "20m",
"min_doc_count": "0",
"trimEdges": "0"
"interval": "1000",
"min_doc_count": "15"
},
"type": "date_histogram"
"type": "histogram"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test now shows that even with "histogram" and "min_doc_count" set, query is built with default date_histogram

@fridgepoet fridgepoet marked this pull request as ready for review October 5, 2023 16:51
@fridgepoet fridgepoet requested a review from a team as a code owner October 5, 2023 16:51
@fridgepoet fridgepoet requested review from iwysiu and sarahzinger and removed request for a team October 5, 2023 16:51
@@ -7,14 +7,13 @@
"alias": "",
"bucketAggs": [
{
"field": "timestamp",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason that the field changed?

Copy link
Member Author

@fridgepoet fridgepoet Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, sorry this should have also gone into an explanatory comment. this also shows that no matter the field put here, the "defaultTimeField" will be used over here https://github.com/grafana/opensearch-datasource/pull/277/files#diff-44afe4fa7a308b985c56a75c710979bd17870768f6365e65baa40115849846e6R91 resulting in this kind of query to OpenSearch here https://github.com/grafana/opensearch-datasource/pull/277/files/98a8fa01a4bf2aa0adc11573355c0143f38a1c99#diff-1a311aa56365fe4dc3d664446f14d8c7835626e6a2a908be02eee3d403ad4808R44.

@fridgepoet fridgepoet merged commit 00853ff into main Oct 6, 2023
@fridgepoet fridgepoet deleted the fix-lucene-logs branch October 6, 2023 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants