-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Timelion query language support for scripted fields #14700
Conversation
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 a great addition.
The limitation the index-param needs to match the indexpattern-name is very reasonable.
I don't really know why this isn't working with the logstash-*
index-pattern. Maybe due to the -
character?
@@ -27,7 +27,7 @@ export default new Datasource('es', { | |||
{ | |||
name: 'index', | |||
types: ['string', 'null'], | |||
help: 'Index to query, wildcards accepted' | |||
help: 'Index to query, wildcards accepted. Provide Index Pattern name for scripted field support.' |
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 somewhat of odd, and I might be missing something.
Have you tested this with the default logstash-*
index-pattern, from the examples with makelogs? I tried it, and no matching saved-objects come up. Creating a new index pattern, something like log*
, does make it work.
}; | ||
} else { | ||
dateAgg.time_buckets.aggs[metricName][metric[0]] = { field: metric[1] }; | ||
} |
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.
thoughts on extracting this boilerplate in separate module, shared with buildRequest? There's some overlap
const scriptedField = scriptedFields.find(field => {
return field.name === clause[0];
});
if (scriptedField) {
termsAgg.script = {
inline: scriptedField.script,
lang: scriptedField.lang
};
} else {
termsAgg.field = clause[0];
}
9645f26
to
0cd8843
Compare
@thomasneirynck Turns out the As a work around, I can remove characters like |
@nreese oh so funny, known issue. work-around sounds good. i think that'll be better than just transparently fail. it'd also be a weird limitation to document. |
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.
sweet, so all it took was quotes...
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.
nice! LGTM
* update run REST API to fetch index pattern and use script for scripted fields * allow scripted fields for elasticsearch split argument * add test cases for scripted fields to elasticsearch test * update help text for .es() index argument * move scripted field check into common file, remove stop characters from index pattern title * use space instead of nothing for replacing stop chars * wrap index name in quotes instead of removing dash character
* update run REST API to fetch index pattern and use script for scripted fields * allow scripted fields for elasticsearch split argument * add test cases for scripted fields to elasticsearch test * update help text for .es() index argument * move scripted field check into common file, remove stop characters from index pattern title * use space instead of nothing for replacing stop chars * wrap index name in quotes instead of removing dash character
* update run REST API to fetch index pattern and use script for scripted fields * allow scripted fields for elasticsearch split argument * add test cases for scripted fields to elasticsearch test * update help text for .es() index argument * move scripted field check into common file, remove stop characters from index pattern title * use space instead of nothing for replacing stop chars * wrap index name in quotes instead of removing dash character
* update run REST API to fetch index pattern and use script for scripted fields * allow scripted fields for elasticsearch split argument * add test cases for scripted fields to elasticsearch test * update help text for .es() index argument * move scripted field check into common file, remove stop characters from index pattern title * use space instead of nothing for replacing stop chars * wrap index name in quotes instead of removing dash character
fixes #9022
Adds scripted field support to timelion
.es()
for themetric
andsplit
arguments