2017-08-23 33 views
0

在我的應用程序中,我支持本地化搜索。我正在使用彈性搜索,但我在使用意大利分析器時遇到了問題。請注意,其他分析儀正常工作,但只有意大利分析儀引發以下錯誤。ES搜索失敗的意大利分析儀

{ 
    "total": 25, 
    "successful": 20, 
    "failed": 5, 
    "failures": [{ 
     "shard": 0, 
     "index": "default_37", 
     "node": "hhgqY2HtRWeAFZehZgVC5w", 
     "reason": { 
      "type": "illegal_argument_exception", 
      "reason": "Invalid format: \"test\"" 
     } 
    }] 
} 

我的查詢看起來是這樣的:

{ 
    "from": 0, 
    "size": 5, 
    "query": { 
     "bool": { 
      "must": [{ 
       "multi_match": { 
        "query": "mongo", 
        "fields": ["keywords", "tag", "*_it", "subject", "body"] 
       } 
      }], 
      "filter": { 
       "bool": { 
        "must": [{ 
         "term": { 
          "instanceid": "6" 
         } 
        }, { 
         "terms": { 
          "articlesectionid": [1] 
         } 
        }, { 
         "term": { 
          "status": 1 
         } 
        }] 
       } 
      } 
     } 
    }, 
    "highlight": { 
     "fields": { 
      "keywords": {}, 
      "tag": {}, 
      "*_it": {}, 
      "subject": {}, 
      "body": {} 
     } 
    }, 
    "sort": { 
     "_score": { 
      "order": "desc" 
     } 
    } 
} 

這裏是我的映射看起來像:

{ 
    "default_37": { 
     "mappings": { 
      "articles": { 
       "properties": { 
        "articlesectionid": { 
         "type": "integer" 
        }, 
        "boost": { 
         "type": "long" 
        }, 
        "contents_ar": { 
         "analyzer": "arabic", 
         "type": "string" 
        }, 
        "contents_bg": { 
         "analyzer": "bulgarian", 
         "type": "string" 
        }, 
        "contents_bs": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_ca": { 
         "analyzer": "catalan", 
         "type": "string" 
        }, 
        "contents_cs": { 
         "analyzer": "czech", 
         "type": "string" 
        }, 
        "contents_da": { 
         "analyzer": "danish", 
         "type": "string" 
        }, 
        "contents_de": { 
         "analyzer": "german", 
         "type": "string" 
        }, 
        "contents_el": { 
         "analyzer": "greek", 
         "type": "string" 
        }, 
        "contents_en-gb": { 
         "analyzer": "english", 
         "type": "string" 
        }, 
        "contents_en-us": { 
         "analyzer": "english", 
         "type": "string" 
        }, 
        "contents_es": { 
         "analyzer": "spanish", 
         "type": "string" 
        }, 
        "contents_es-419": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_et": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_fi": { 
         "analyzer": "finnish", 
         "type": "string" 
        }, 
        "contents_fil": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_fr": { 
         "analyzer": "french", 
         "type": "string" 
        }, 
        "contents_he": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_hr": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_hu": { 
         "analyzer": "hungarian", 
         "type": "string" 
        }, 
        "contents_id": { 
         "analyzer": "indonesian", 
         "type": "string" 
        }, 
        "contents_is": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_it": { 
         "analyzer": "italian", 
         "type": "string" 
        }, 
        "contents_ja": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_ko": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_lt": { 
         "analyzer": "lithuanian", 
         "type": "string" 
        }, 
        "contents_lv": { 
         "analyzer": "latvian", 
         "type": "string" 
        }, 
        "contents_ms": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_nl": { 
         "analyzer": "dutch", 
         "type": "string" 
        }, 
        "contents_no": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_pl": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_pt": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_pt-br": { 
         "analyzer": "brazilian", 
         "type": "string" 
        }, 
        "contents_ro": { 
         "analyzer": "romanian", 
         "type": "string" 
        }, 
        "contents_ru": { 
         "analyzer": "russian", 
         "type": "string" 
        }, 
        "contents_sk": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_sl": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_sr": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_sv": { 
         "analyzer": "swedish", 
         "type": "string" 
        }, 
        "contents_th": { 
         "analyzer": "thai", 
         "type": "string" 
        }, 
        "contents_tr": { 
         "analyzer": "turkish", 
         "type": "string" 
        }, 
        "contents_uk": { 
         "analyzer": "english", 
         "type": "string" 
        }, 
        "contents_vi": { 
         "analyzer": "standard", 
         "type": "string" 
        }, 
        "contents_zh-cn": { 
         "analyzer": "cjk", 
         "type": "string" 
        }, 
        "contents_zh-tw": { 
         "analyzer": "cjk", 
         "type": "string" 
        }, 
        "createdat": { 
         "format": "strict_date_optional_time||epoch_millis", 
         "type": "date" 
        }, 
        "instanceid": { 
         "type": "long" 
        }, 
        "keywords": { 
         "term_vector": "yes", 
         "type": "string" 
        }, 
        "object": { 
         "type": "string" 
        }, 
        "objecthash": { 
         "type": "string" 
        }, 
        "objectid": { 
         "type": "string" 
        }, 
        "status": { 
         "type": "short" 
        }, 
        "tag": { 
         "index": "not_analyzed", 
         "type": "string" 
        }, 
        "title_ar": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "arabic", 
         "type": "string" 
        }, 
        "title_bg": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "bulgarian", 
         "type": "string" 
        }, 
        "title_bs": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_ca": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "catalan", 
         "type": "string" 
        }, 
        "title_cs": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "czech", 
         "type": "string" 
        }, 
        "title_da": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "danish", 
         "type": "string" 
        }, 
        "title_de": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "german", 
         "type": "string" 
        }, 
        "title_el": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "greek", 
         "type": "string" 
        }, 
        "title_en-gb": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "english", 
         "type": "string" 
        }, 
        "title_en-us": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "english", 
         "type": "string" 
        }, 
        "title_es": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "spanish", 
         "type": "string" 
        }, 
        "title_es-419": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_et": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_fi": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "finnish", 
         "type": "string" 
        }, 
        "title_fil": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_fr": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "french", 
         "type": "string" 
        }, 
        "title_he": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_hr": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_hu": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "hungarian", 
         "type": "string" 
        }, 
        "title_id": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "indonesian", 
         "type": "string" 
        }, 
        "title_is": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_it": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "italian", 
         "type": "string" 
        }, 
        "title_ja": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_ko": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_lt": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "lithuanian", 
         "type": "string" 
        }, 
        "title_lv": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "latvian", 
         "type": "string" 
        }, 
        "title_ms": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_nl": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "dutch", 
         "type": "string" 
        }, 
        "title_no": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_pl": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_pt": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_pt-br": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "brazilian", 
         "type": "string" 
        }, 
        "title_ro": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "romanian", 
         "type": "string" 
        }, 
        "title_ru": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "russian", 
         "type": "string" 
        }, 
        "title_sk": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_sl": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_sr": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_sv": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "swedish", 
         "type": "string" 
        }, 
        "title_th": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "thai", 
         "type": "string" 
        }, 
        "title_tr": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "turkish", 
         "type": "string" 
        }, 
        "title_uk": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "english", 
         "type": "string" 
        }, 
        "title_vi": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "standard", 
         "type": "string" 
        }, 
        "title_zh-cn": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "cjk", 
         "type": "string" 
        }, 
        "title_zh-tw": { 
         "analyzer": "autocomplete", 
         "search_analyzer": "cjk", 
         "type": "string" 
        }, 
        "updatedat": { 
         "format": "strict_date_optional_time||epoch_millis", 
         "type": "date" 
        } 
       } 
      } 
     } 
    } 
} 

我不知道什麼是錯在這裏。映射看起來正確。應該沒有理由提出Invalid format錯誤。

回答

0

您的日誌文件中是否有堆棧跟蹤?如果是這樣,請提供。如果刪除查詢中突出顯示的部分,也會發生這種情況嗎?另外,您是否可以創建一個最小可重現的示例,該示例僅包含意大利語分析器和示例文檔,可以讓其他人重現該問題。謝謝!