Skip to content

Commit

Permalink
Merge branch 'master' into implement/absolute-test-archive-paths
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Jun 8, 2021
2 parents e9b638f + 08ff557 commit 07163ce
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 15 deletions.
Binary file modified docs/discover/images/discover-search-for-relevance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/discover/images/double-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/discover/images/downward-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 24 additions & 12 deletions docs/discover/search-for-relevance.asciidoc
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
[[discover-search-for-relevance]]
== Search for relevance
Sometimes you might be unsure which documents best match your question.
Sometimes you might be unsure which documents best match your search.
{es} assigns a relevancy, or score to each document, so you can
can narrow your search to the documents with the most relevant results.
The higher the score, the better it matches your query.

For example, suppose you have the <<gs-get-data-into-kibana, sample flights data set>>, and you're a searching for
a flight that arrived or departed from `Warsaw` or `Venice` when the weather was clear.
This example shows how to use *Discover* to list
your documents from most relevant to least relevant. This example uses
the <<gs-get-data-into-kibana, sample flights data set>>, or you can use your own data.

. In *Discover*, open the index pattern dropdown, and select `kibana_sample_data_flight`.
. In the query bar, click *KQL*, and switch to the <<lucene-query, Lucene query syntax>>.
. Search for `Warsaw OR Venice OR Clear`.
. If you don't see any results, open the time filter and select a time range that contains data.
. From the list of *Available fields*, add `_score` to the document table.
. In the document table, click the header for the `_score` column, and then sort the column by descending scores.
. In *Discover*, open the index pattern dropdown, and select that data you want to work with.
+
The results are currently sorted by first `Time`, and then by `_score`.
. To sort only by `_score`, remove the `Time` field.
For the sample flights data, set the index pattern to *kibana_sample_data_flights*.
. In the query bar, click *KQL*, and then turn it off.
+
Your table now shows documents with the best matches, from most to least relevant.
You're now using the <<lucene-query, Lucene query syntax>>.
. Run your search. For the sample data, try:
+
```ts
Warsaw OR Venice OR Clear
```
. If you don't see any results, expand the <<set-time-filter,time range>>, for example to *Last 7 days*.
. From the list of *Available fields*, add `_score` and any other fields you want to the document table.
. To sort the `_score` column in descending order, hover over its header, and then click twice on
the arrow icon
image:images/double-arrow.png[Double arrow icon to indicate sorting] so it changes to
image:images/downward-arrow.png[Downward pointing arrow to indicate descending sorting].
+
At this point, you're doing a multi-column sort: first by `Time`, and then by `_score`.
. To turn off sorting for the `Time` field, hover over its header, and then click the down arrow.
+
Your table now sorts documents from most to least relevant.
+
[role="screenshot"]
image::images/discover-search-for-relevance.png["Example of a search for relevance"]
3 changes: 2 additions & 1 deletion x-pack/plugins/fleet/server/services/package_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ class PackagePolicyService {
else {
const [, packageInfo] = await Promise.all([
ensureInstalledPackage({
esClient,
savedObjectsClient: soClient,
pkgName: packagePolicy.package.name,
esClient,
pkgVersion: packagePolicy.package.version,
}),
pkgInfoPromise,
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export const EmbeddableAnomalyChartsContainer: FC<EmbeddableAnomalyChartsContain
id={`mlAnomalyExplorerEmbeddableWrapper-${id}`}
style={{
width: '100%',
overflowY: 'hidden',
overflowY: 'auto',
overflowX: 'hidden',
padding: '8px',
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export const IndexParamsFields = ({

useEffect(() => {
setDocumentToIndex(getDocumentToIndex(documents));
if (documents === null) {
setDocumentToIndex('{}');
}
}, [documents]);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,29 @@ describe('alert reducer', () => {
);
});

test('if the existing alert action params property was set to undefined (when other connector was selected)', () => {
initialAlert.actions.push({
id: '',
actionTypeId: 'testId',
group: 'Alert',
params: {
testActionParam: 'some value',
},
});
const updatedAlert = alertReducer(
{ alert: initialAlert },
{
command: { type: 'setAlertActionParams' },
payload: {
key: 'testActionParam',
value: undefined,
index: 0,
},
}
);
expect(updatedAlert.alert.actions[0].params.testActionParam).toBe(undefined);
});

test('if alert action property was updated', () => {
initialAlert.actions.push({
id: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const alertReducer = <AlertPhase extends InitialAlert | Alert>(
if (
index === undefined ||
alert.actions[index] == null ||
isEqual(alert.actions[index][key], value)
(!!alert.actions[index][key] && isEqual(alert.actions[index][key], value))
) {
return state;
} else {
Expand Down

0 comments on commit 07163ce

Please sign in to comment.