2014-05-21 95 views
0

我遇到了自動生成的elasticSearch查詢的問題。當運行它,七個碎片我使用索引六返回成功,第七返回此錯誤:調試ElasticSearch布爾查詢

index: "shard" 
reason: "ClassCastException[ 
    org.elasticsearch.common.mvel2.compiler.BlankLiteral cannot be cast to java.lang.Boolean]" 
shard: 1 
status: 500 
successful: 6 
total: 7 

我怎樣才能弄清楚這是從哪裏來的,考慮到解釋端點由於根查詢是一個bool,完全不會產生任何結果?

查詢如下:

{ 
    "query": { 
    "bool": { 
     "must": [ 
     { 
      "filtered": { 
      "query": { 
       "range": { 
       "date": { 
        "lte": "2014-05-21T21:59:59+00:00", 
        "gte": "2013-01-23T23:00:00+00:00" 
       } 
       } 
      }, 
      "filter": { 
       "not": { 
       "terms": { 
        "idCountry": [ 
        "9999" 
        ] 
       } 
       } 
      } 
      } 
     }, 
     { 
      "filtered": { 
      "query": { 
       "nested": { 
       "path": "reports", 
       "query": { 
        "terms": { 
        "reports.36317.flag": [ 
         "o" 
        ], 
        "minimum_should_match": 1 
        } 
       } 
       } 
      }, 
      "filter": { 
       "nested": { 
       "path": "reports", 
       "filter": { 
        "exists": { 
        "field": "reports.36317" 
        } 
       } 
       } 
      } 
      } 
     } 
     ] 
    } 
    }, 
    "script_fields": { 
    "idTone": { 
     "script": "_source.reports[reportId].empty || _source.reports[reportId].idTone.empty ? _source.idLanguage : _source.reports[reportId].idTone", 
     "params": { 
     "reportId": "36317" 
     } 
    }, 
    "tags": { 
     "script": "_source.reports[reportId].empty || _source.reports[reportId].tags.empty ? 'none' : _source.reports[reportId].tags", 
     "params": { 
     "reportId": "36317" 
     } 
    }, 
    "flag": { 
     "script": "_source.reports[reportId].empty || _source.reports[reportId].flag.empty ? 'O' : _source.reports[reportId].flag", 
     "params": { 
     "reportId": "36317" 
     } 
    }, 
    "synthesioRank": { 
     "script": "_source.reports[reportId].empty || _source.reports[reportId].synthesioRank.empty || _source.reports[reportId].synthesioRank == null ? '0' : _source.reports[reportId].synthesioRank", 
     "params": { 
     "reportId": "36317" 
     } 
    }, 
    "idUserEngagement": { 
     "script": "_source.reports[reportId].empty || _source.reports[reportId].idUserEngagement == null ? '0' : _source.reports[reportId].idUserEngagement", 
     "params": { 
     "reportId": "36317" 
     } 
    }, 
    "idStatus": { 
     "script": "_source.reports[reportId].empty || _source.reports[reportId].idStatus == null ? '0' : _source.reports[reportId].idStatus", 
     "params": { 
     "reportId": "36317" 
     } 
    } 
    }, 
    "fields": [ 
    "access", 
    "content", 
    "title", 
    "date", 
    "geo", 
    "idItem", 
    "idSiteType", 
    "idSite", 
    "idSource", 
    "idSourceType", 
    "idTopic", 
    "media", 
    "url", 
    "idLanguage", 
    "idDocument", 
    "idCountry" 
    ] 
} 

回答

1

拋出的異常與MVEL,用於你的情況script_fields腳本語言做。

,只有1碎片可能失敗,這意味着你的腳本領域之一的執行對在碎片一個特定的文件失敗。

你可以嘗試,並刪除這些領域,一個接一個,與任何濾波器,要求現場一起,能把那個失敗的人。

注:解釋API旨在幫助理解排序的查詢內線得分計算。它不會以任何方式幫助您處理失敗的查詢。

+0

謝謝你的提示!我會盡可能按照你的說法來做,並會保持你的進展。 –