はじめに
開発でOpen Searchを使っているのですが、その中で引っかかった内容があったためブログ記事にまとめます。
発生した事象
AppSyncでOpenSearchを使用したときに取得できるデータとできないデータがありました。
ログを調査したところ以下のようなエラーが発生していました。
"status": 400,
"error": {
"type": "mapper_parsing_exception",
"reason": "failed to parse field [salesEndDate] of type [date] in document with id '3a31a493-0dd3-495d-a5e1-cbcab96e0798'. Preview of field's value: '2025/07/02'",
DBの日にちデータを2025/07/02
としていたためエラーが発生していました。
日付をOpensearchが認識する形式に変換する必要があります。
2025/07/02 → 2025-07-02
日にちのデータを「/」で持つことは多いと思うので意外な落とし穴にご注意ください!