Use filter_path for improving the search helpers performances (#1199)

This commit is contained in:
Tomas Della Vedova
2020-05-25 14:25:32 +02:00
committed by GitHub
parent d1ad7bd22b
commit 84217fc737
4 changed files with 105 additions and 10 deletions

View File

@ -212,7 +212,8 @@ console.log(result)
----
=== Search Helper
A simple wrapper around the search API. Instead of returning the entire `result` object it will return only the search documents result.
A simple wrapper around the search API. Instead of returning the entire `result` object it will return only the search documents source.
For improving the performances, this helper automatically adds `filter_path=hits.hits._source` to the querystring.
[source,js]
----
@ -281,6 +282,7 @@ for await (const result of scrollSearch) {
=== Scroll Documents Helper
It works in the same way as the scroll search helper, but it returns only the documents instead. Note, every loop cycle will return you a single document, and you can't use the `clear` method.
For improving the performances, this helper automatically adds `filter_path=hits.hits._source` to the querystring.
[source,js]
----