文字列として保存したい生年月日がいくつかあります。データに対してクエリや分析を行う予定はありません。データを保存したいだけです。
私が与えられた入力データは、さまざまなランダムな形式であり、一部には のような文字列が含まれています(approximate)
。Elastic は、これが日付形式の日付フィールドである必要があると判断しました。つまり、Elastic が異常に日付を受け取る1981 (approx)
と、入力が無効な形式であると表示されます。
入力日付を変更する代わりに、日付タイプを文字列に変更したいと考えています。
ドキュメントを確認し、PUT
マッピング API を使用してマッピングを更新しようとしましたが、エラスティックが解析エラーを返し続けます。
ここのドキュメントに基づいています:
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html
私が試してみました:
PUT /sanctions_lists/eu_financial_sanctions/_mapping
{
"mappings":{
"eu_financial_sanctions":{
"properties": {
"birth_date": {
"type": "string", "index":"not_analyzed"
}
}
}
}
}
しかし、戻ります:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [mappings : {eu_financial_sanctions={properties={birth_date={type=string, index=not_analyzed}}}}]"
}
],
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [mappings : {eu_financial_sanctions={properties={birth_date={type=string, index=not_analyzed}}}}]"
},
"status": 400
}
質問のまとめ
エラスティックサーチの自動的に決定された日付フィールドをオーバーライドして、フィールド タイプとして文字列を強制することは可能ですか?
ノート
リクエストを送信するためにGoogle Chromeセンスプラグインを使用しています
エラスティック検索のバージョンは 2.3 です