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
Elasticsearch: Handle no-index case in backend mode #68534
Conversation
Backend code coverage report for PR #68534
|
Frontend code coverage report for PR #68534 |
3f96da6
to
f9b7e3e
Compare
Hello @gabor!
Please, if the current pull request addresses a bug fix, label it with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
name := ip.indexName | ||
if name != "" { | ||
return []string{name}, nil | ||
} else { | ||
return []string{}, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is super nit pick, but I don't think name := ip.indexName
improves readability and it adds assigning of new variable. So I would suggest to just do
if ip.indexName != "" {
return []string{ip.indexName}, nil
} else {
return []string{}, nil
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious to know if, with Go, you could do both things at the same time with:
return []string{ip.indexName}, nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matyax unfortunately no, in case of indexName
being ""
(empty-string), that would return a single-item array where the item is empty-string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right! I still have a hard time understanding this array format. Thanks for the explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ivanahuckova agreed, changed 👍
* elastic: backend migration: fix no-index case * improved code (cherry picked from commit fcef387)
fixes #68531
when the index-field is not filled out in the elastic datasource config, currently we send the following index-value to the database:
index: [""]
what we should be sending is:
index: []
(maybe even not sending the index-entry at all, but this construct seems to work)how to test:
no pattern
index: []
part in itlogs-*
(for devenv-elastic). save