いくつかの文字列フィールドを持つ特定の種類のデータを格納する ElasticSearch にインデックスを作成したいと思います。言語はハンガリー語です。
次の本文で HTTP PUT コマンドを実行しました。
{
"settings" : {
"analysis" : {
"analyzer" : {
"hu" : {
"tokenizer" : "standard",
"filter" : [ "lowercase", "hu_HU" ]
}
},
"filter" : {
"hu_HU" : {
"type" : "hunspell",
"locale" : "hu_HU",
"language" : "hu_HU"
}
}
}
},
"mappings": {
"printedArticle": {
"_source": {"enabled": false},
"properties": {
"_id": {"type": "string", "store": true},
"mysqlid": {"type": "long", "store": false},
"publishDate": {"type": "date", "format": "dateOptionalTime", "store": false},
"title": {"type": "string", "analyzer": "hu", "analyze": true, "store": false},
"lead": {"type": "string", "analyzer": "hu", "analyze": true, "store": false},
"content": {"type": "string", "analyzer": "hu", "analyze": true, "store": false},
"participants": {"type": "string", "analyzer": "hu", "analyze": true, "store": false},
"authors": {"type": "string", "analyzer": "hu", "analyze": true, "store": false},
"subtitle": {"type": "string", "analyzer": "hu", "analyze": true, "store": false}
}
}
}
}
次に、いくつかのテスト テキストを含む 1 つのレコードを挿入し、次のような GET 要求で Elastic API を介して検索を実行すると、次のようになります。
http://localhost:9200/mf_pa/_search?q=MYTESTTEXT
私のテストテキストが私の記録の単語の1つと等しい場合にのみ、私の記録が作成されます。
分析 API を使用して、同様のテキストを分析しようとしました。
http://localhost:9200/mf_pa/_analyze?analyzer=hu&text=My text to tokenize
テストテキストを適切にトークン化しました。この事実に基づいて、以前に見つかったトークンを検索クエリに入れると、レコードが見つかると予想されますが、そうではありません。
英語の例では、私のテキストは「忘れられない」であり、クエリは「忘れる」であると言えます。レコードを見つけるにはどうすればよいですか?