Skip to content

Commit

Permalink
Fix and improve suggestion experience in Formula (elastic#19)
Browse files Browse the repository at this point in the history
* ✨ Revisit documentation and suggestions

* 👌 Integrated feedback
  • Loading branch information
dej611 authored May 24, 2021
1 parent 4d7d2ba commit c97f6f6
Show file tree
Hide file tree
Showing 12 changed files with 179 additions and 198 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,10 @@ Calculates the rate of an ever increasing counter. This function will only yield
If the value does get smaller, it will interpret this as a counter reset. To get most precise results, \`counter_rate\` should be calculated on the \`max\` of a field.
This calculation will be done separately for separate series defined by filters or top values dimensions.
It uses the current interval when used in Formula.
Example: Visualize the rate of bytes received over time by a memcached server:
\`\`\`
counter_rate(max(memcached.stats.read.bytes))
\`\`\`
${'`counter_rate(max(memcached.stats.read.bytes))`'}
`,
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,7 @@ Calculates the cumulative sum of a metric over time, adding all previous values
This calculation will be done separately for separate series defined by filters or top values dimensions.
Example: Visualize the received bytes accumulated over time:
\`\`\`
cumulative_sum(sum(bytes))
\`\`\`
${'`cumulative_sum(sum(bytes))`'}
`,
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ Differences requires the data to be sequential. If your data is empty when using
This calculation will be done separately for separate series defined by filters or top values dimensions.
Example: Visualize the change in bytes received over time:
\`\`\`
differences(sum(bytes))
\`\`\`
${'`differences(sum(bytes))`'}
`,
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@ This calculation will be done separately for separate series defined by filters
Takes a named parameter \`window\` which specifies how many last values to include in the average calculation for the current value.
Example: Smooth a line of measurements:
\`\`\`
moving_average(sum(bytes), window=5)
\`\`\`
${'`moving_average(sum(bytes), window=5)`'}
`,
values: {
defaultValue: WINDOW_DEFAULT_VALUE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,17 @@ export const cardinalityOperation: OperationDefinition<CardinalityIndexPatternCo
documentation: {
section: 'elasticsearch',
signature: i18n.translate('xpack.lens.indexPattern.cardinality.signature', {
defaultMessage: 'field: string, [kql]?: string, [lucene]?: string',
defaultMessage: 'field: string',
}),
description: i18n.translate('xpack.lens.indexPattern.cardinality.documentation', {
defaultMessage: `
Calculates the number of unique values of a specified field. Works for number, string, date and boolean values.
Example: Calculate the number of different products:
\`\`\`
unique_count(product.name)
\`\`\`
${'`unique_count(product.name)`'}
Example: Calculate the number of different products from the "clothes" group:
\`\`\`
unique_count(product.name, kql="product.group=clothes")
\`\`\`
${"`unique_count(product.name, kql='product.group=clothes')`"}
`,
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,16 @@ export const countOperation: OperationDefinition<CountIndexPatternColumn, 'field
filterable: true,
documentation: {
section: 'elasticsearch',
signature: i18n.translate('xpack.lens.indexPattern.count.signature', {
defaultMessage: '[kql]?: string, [lucene]?: string',
}),
signature: '',
description: i18n.translate('xpack.lens.indexPattern.count.documentation', {
defaultMessage: `
Calculates the number of documents.
Example: Calculate the number of documents:
\`\`\`
count()
\`\`\`
${'`count()`'}
Example: Calculate the number of documents matching a certain filter:
\`\`\`
count(kql="price > 500")
\`\`\`
${"`count(kql='price > 500')`"}
`,
}),
},
Expand Down
Loading

0 comments on commit c97f6f6

Please sign in to comment.