キーワードタイプフィールドで大文字と小文字を区別しない集計を試みていますが、これを動作させる際に問題があります。Elasticsearch 5.2.2:集計の大文字と小文字を区別しない
私が今まで試したのは、「キーワード」トークナイザと「小文字」フィルタを使用する「小文字」というカスタムアナライザを追加することでした。次に、作業したいフィールドの「use_lowercase」というマッピングにフィールドを追加しました。フィールド内の用語を検索したいので、既存の「テキスト」と「キーワード」フィールドコンポーネントも保持したいと思っていました。ここで
は、カスタム・アナライザを含むインデックスの定義、次のとおりです。これまでのところは良い
POST authors/famousbooks/1
{
"Book": "The Mysterious Affair at Styles",
"Year": 1920,
"Price": 5.92,
"Genre": "Crime Novel",
"Author": "Agatha Christie"
}
POST authors/famousbooks/2
{
"Book": "And Then There Were None",
"Year": 1939,
"Price": 6.99,
"Genre": "Mystery Novel",
"Author": "Agatha christie"
}
:
PUT authors
{
"settings": {
"analysis": {
"analyzer": {
"lowercase": {
"type": "custom",
"tokenizer": "keyword",
"filter": "lowercase"
}
}
}
},
"mappings": {
"famousbooks": {
"properties": {
"Author": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"use_lowercase": {
"type": "text",
"analyzer": "lowercase"
}
}
}
}
}
}
}
は今、私は同じ著者とが、異なる場合と2件のレコードを追加します。私は、著者に基づいて用語の集約を行う
GET authors/famousbooks/_search
{
"size": 0,
"aggs": {
"authors-aggs": {
"terms": {
"field": "Author.use_lowercase"
}
}
}
}
場合、私は次のような結果を得る今:
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [Author.use_lowercase] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory."
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "authors",
"node": "yxcoq_eKRL2r6JGDkshjxg",
"reason": {
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [Author.use_lowercase] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory."
}
}
],
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [Author.use_lowercase] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory."
}
},
"status": 400
}
をだから、凝集が検索フィールドではなくテキストであると考えているように私には思えますキーワードとなり、フィールドデータの警告が表示されます。私は、ESは、用語フィールドが実際には(カスタムアナライザを介して)キーワードであり、集約可能であることを認識するほど洗練されていると思うだろうが、そうではないようだ。
Authorのマッピングに「"fielddata":true
」を追加すると、集計はうまくいきますが、この値を設定する際にヒープ使用量が高いことを警告しているので、これをすることを躊躇しています。
このタイプの非機密キーワードアグリゲーションのベストプラクティスはありますか?私はとのマッピングセクションにちょうどいいと思っていましたが、そうは思われません。
私は"fielddata":true
ルートに行くと、これを動作させるには大きすぎるスティックを使用する必要があるように感じます。これについての助けに感謝します!
、。 マッピングを設定する際のエラーメッセージ: [fields]のマッピング定義にサポートされていないパラメータがあります:[analyzer:lowercase] – GoodEnuf