Bird
0
0

You want to index documents with a date field that accepts either ISO 8601 strings or epoch seconds. How should you define the date field format in the mapping?

hard🚀 Application Q8 of 15
Elasticsearch - Mappings and Data Types
You want to index documents with a date field that accepts either ISO 8601 strings or epoch seconds. How should you define the date field format in the mapping?
A["yyyy/MM/dd", "epoch_millis"]
B"epoch_millis"
C["strict_date_optional_time", "epoch_second"]
D"yyyy-MM-dd HH:mm:ss"
Step-by-Step Solution
Solution:
  1. Step 1: Identify required formats

    ISO 8601 strings correspond to "strict_date_optional_time" format, epoch seconds correspond to "epoch_second".
  2. Step 2: Define formats as an array

    Use an array of formats to accept both types.
  3. Final Answer:

    ["strict_date_optional_time", "epoch_second"] -> Option C
  4. Quick Check:

    Multiple formats array allows flexible date inputs [OK]
Quick Trick: Use array of formats to accept multiple date input types [OK]
Common Mistakes:
MISTAKES
  • Using only epoch_millis
  • Using wrong format strings
  • Not using array for multiple formats

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes