0
0
Elasticsearchquery~5 mins

Runtime fields in Elasticsearch - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What are runtime fields in Elasticsearch?
Runtime fields are fields that are computed on the fly during query time, without being stored on disk. They allow you to define new fields based on existing data without reindexing.
Click to reveal answer
beginner
How do runtime fields differ from stored fields in Elasticsearch?
Stored fields are saved on disk during indexing and retrieved during search. Runtime fields are calculated dynamically at query time and are not stored, which means no reindexing is needed to add or change them.
Click to reveal answer
beginner
Which scripting language is commonly used to define runtime fields in Elasticsearch?
Painless is the default and recommended scripting language used to define runtime fields in Elasticsearch because it is secure and optimized for performance.
Click to reveal answer
intermediate
Example: What does this runtime field script do?<br>
emit(doc['price'].value * 1.2)
This script creates a runtime field that calculates a new value by multiplying the existing 'price' field by 1.2, effectively adding a 20% increase to the price at query time.
Click to reveal answer
intermediate
Can runtime fields be used for sorting and aggregations in Elasticsearch?
Yes, runtime fields can be used for sorting and aggregations, but because they are computed at query time, they may be slower than using stored fields.
Click to reveal answer
What is the main advantage of using runtime fields in Elasticsearch?
ANo need to reindex data to add or change fields
BThey are stored permanently on disk
CThey improve indexing speed
DThey replace all stored fields
Which language is used to write scripts for runtime fields?
AJavaScript
BPainless
CPython
DSQL
Runtime fields are computed when?
ADuring indexing
BOnly during cluster restart
CAt query time
DWhen data is stored
Which of these is a limitation of runtime fields?
AMay be slower than stored fields for queries
BCannot be used in aggregations
CRequire reindexing to change
DCannot access other fields
What does this runtime field script do?
emit(doc['age'].value + 5)
ASubtracts 5 from age
BMultiplies age by 5
CDivides age by 5
DAdds 5 to age
Explain what runtime fields are and why they are useful in Elasticsearch.
Think about how you can add new data views without changing stored data.
You got /4 concepts.
    Describe how you would create a runtime field that increases a numeric field by 10%.
    Consider a simple math operation inside the script.
    You got /4 concepts.