You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The script fields support in the search API to allow to extract source elements. The extract element (and its "tree" of data) is then streamed back to the user. Here is an example:
Note the _source keyword here to navigate the json like model.
Its important to understand the difference between doc['my_field'].value and _source.my_field. The first, using the doc keyword, will cause the terms for that field to be loaded to memory (cached), which will result in faster execution, but more memory consumption. Also, it only allows for simple valued fields (can't return a json object from it).
The _source on the other hand causes the source to be loaded, parsed, and then only the relevant part of the json is returned.
Since its a script, logic can also be applied here.
The text was updated successfully, but these errors were encountered:
The script fields support in the search API to allow to extract source elements. The extract element (and its "tree" of data) is then streamed back to the user. Here is an example:
Note the
_source
keyword here to navigate the json like model.Its important to understand the difference between
doc['my_field'].value
and_source.my_field
. The first, using thedoc
keyword, will cause the terms for that field to be loaded to memory (cached), which will result in faster execution, but more memory consumption. Also, it only allows for simple valued fields (can't return a json object from it).The
_source
on the other hand causes the source to be loaded, parsed, and then only the relevant part of the json is returned.Since its a script, logic can also be applied here.
The text was updated successfully, but these errors were encountered: