elasticsearch,full-text-search,Lucene,elasticsearch,Full Text Search" /> elasticsearch,full-text-search,Lucene,elasticsearch,Full Text Search" />

Lucene ElasticSearch:ToomAnyColauses添加高光时出现异常

Lucene ElasticSearch:ToomAnyColauses添加高光时出现异常,lucene,elasticsearch,full-text-search,Lucene,elasticsearch,Full Text Search,我的查询\u字符串查询给我一个ToomanyColauses异常。然而,在我的例子中,我不认为异常是由于以下原因引发的。相反,它似乎与突出显示相关,因为当我从查询中删除突出显示时,它会起作用。这是我的原始查询: { "query" : { "query_string" : { "query" : "aluminium potassium +DOS_UUID:*", "default_field" : "fileTextCon

我的查询\u字符串查询给我一个ToomanyColauses异常。然而,在我的例子中,我不认为异常是由于以下原因引发的。相反,它似乎与突出显示相关,因为当我从查询中删除突出显示时,它会起作用。这是我的原始查询:

{
    "query" : {
        "query_string" : {
            "query" : "aluminium potassium +DOS_UUID:*",
            "default_field" : "fileTextContent.fileTextContentAnalyzed"
        }
    },
    "fields" : [ "attachmentType", "DOS_UUID", "ATT_UUID", "DOCUMENT_REFERENCE", "filename", "isCSR", "mime" ],
    "highlight" : {
        "fields" : {
            "fileTextContent.fileTextContentAnalyzed" : { }
        }
    }
}   
它给了我Toomanycauses错误:

{
   "error": "SearchPhaseExecutionException[Failed to execute phase [query_fetch], all shards failed; shardFailures {[02Z45jhrTCu7bSYy-XSW_g][markosindex][0]: FetchPhaseExecutionException[[markosindex][0]: query[filtered(fileTextContent.fileTextContentAnalyzed:aluminium fileTextContent.fileTextContentAnalyzed:potassium +DOS_UUID:*)->cache(_type:markostype)],from[0],size[10]: Fetch Failed [Failed to highlight field [fileTextContent.fileTextContentAnalyzed]]]; nested: TooManyClauses[maxClauseCount is set to 1024]; }]",
   "status": 500
}
这是一个没有突出显示的查询,它可以工作:

{
    "query" : {
        "query_string" : {
            "query" : "aluminium potassium +DOS_UUID:*",
                    "default_field" : "fileTextContent.fileTextContentAnalyzed"
        }
    },
    "fields" : [ "attachmentType", "DOS_UUID", "ATT_UUID", "DOCUMENT_REFERENCE", "filename", "isCSR", "mime" ]
}
更新1:

这是ElasticSearch日志文件中的stacktrace:

[2014-10-10 16:03:18,236][DEBUG][action.search.type       ] [Doop] [markosindex][0], node[02Z45jhrTCu7bSYy-XSW_g], [P], s[STARTED]: Failed to execute [org.elasticsearch.action.search.SearchRequest@14d7ab1e]
org.elasticsearch.search.fetch.FetchPhaseExecutionException: [markosindex][0]: query[filtered(fileTextContent.fileTextContentAnalyzed:aluminium fileTextContent.fileTextContentAnalyzed:potassium +DOS_UUID:*)->cache(_type:markostype)],from[0],size[10]: Fetch Failed [Failed to highlight field [fileTextContent.fileTextContentAnalyzed]]
    at org.elasticsearch.search.highlight.PlainHighlighter.highlight(PlainHighlighter.java:121)
    at org.elasticsearch.search.highlight.HighlightPhase.hitExecute(HighlightPhase.java:126)
    at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:211)
    at org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:340)
    at org.elasticsearch.search.action.SearchServiceTransportAction$11.call(SearchServiceTransportAction.java:308)
    at org.elasticsearch.search.action.SearchServiceTransportAction$11.call(SearchServiceTransportAction.java:305)
    at org.elasticsearch.search.action.SearchServiceTransportAction$23.run(SearchServiceTransportAction.java:517)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount is set to 1024
    at org.apache.lucene.search.ScoringRewrite$1.checkMaxClauseCount(ScoringRewrite.java:72)
    at org.apache.lucene.search.ScoringRewrite$ParallelArraysTermCollector.collect(ScoringRewrite.java:149)
    at org.apache.lucene.search.TermCollectingRewrite.collectTerms(TermCollectingRewrite.java:79)
    at org.apache.lucene.search.ScoringRewrite.rewrite(ScoringRewrite.java:105)
    at org.apache.lucene.search.MultiTermQuery.rewrite(MultiTermQuery.java:288)
    at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extract(WeightedSpanTermExtractor.java:217)
    at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extract(WeightedSpanTermExtractor.java:99)
    at org.elasticsearch.search.highlight.CustomQueryScorer$CustomWeightedSpanTermExtractor.extractUnknownQuery(CustomQueryScorer.java:89)
    at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extract(WeightedSpanTermExtractor.java:224)
    at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.getWeightedSpanTerms(WeightedSpanTermExtractor.java:474)
    at org.apache.lucene.search.highlight.QueryScorer.initExtractor(QueryScorer.java:217)
    at org.apache.lucene.search.highlight.QueryScorer.init(QueryScorer.java:186)
    at org.apache.lucene.search.highlight.Highlighter.getBestTextFragments(Highlighter.java:197)
    at org.elasticsearch.search.highlight.PlainHighlighter.highlight(PlainHighlighter.java:113)
    ... 9 more
[2014-10-10 16:03:18,237][DEBUG][action.search.type       ] [Doop] All shards failed for phase: [query_fetch]
注意:我使用的是ElasticSearch 1.2.1

更新2:

这是我的映射:

{
   "markosindex": {
      "mappings": {
         "markostype": {
            "_id": {
               "path": "DOCUMENT_REFERENCE"
            },
            "properties": {
               "ATT_UUID": {
                  "type": "string",
                  "index": "not_analyzed"
               },
               "DOCUMENT_REFERENCE": {
                  "type": "string",
                  "index": "not_analyzed"
               },
               "DOS_UUID": {
                  "type": "string",
                  "index": "not_analyzed"
               },
               "attachmentType": {
                  "type": "string",
                  "index": "not_analyzed"
               },
               "fileTextContent": {
                  "type": "string",
                  "index": "no",
                  "fields": {
                     "fileTextContentAnalyzed": {
                        "type": "string"
                     }
                  }
               },
               "filename": {
                  "type": "string",
                  "index": "not_analyzed"
               },
               "isCSR": {
                  "type": "boolean"
               },
               "mime": {
                  "type": "string",
                  "index": "not_analyzed"
               }
            }
         }
      }
   }
}

有什么想法吗?谢谢

能否从日志文件中发布完整的堆栈跟踪?这是由于通配符查询造成的。但请尝试将查询字符串的rewite参数设置为“top_terms_20”。不确定这是否有效,但值得一试。请参见此,顶部术语起作用(&T)(使用Nstrange时,DOS_UUID的典型值是什么,即它是字母数字的,如何分析它。在索引时,82个不同的DOS_UUID不需要在分析中产生82个不同的术语。如果未分析DOS_UUID字段,则我理解它应该是82个子句。@MarkosFragkakis映射看起来很好,我无法找出这会导致t的原因。)他重写以创建超过1024个子句,这可能比将其作为问题发布在elastisearch上要好。但是,对于上述查询,由于您仅在fileTextContent.FileTextContentAnalysis上突出显示,因此您可能应该使用突出显示的突出显示查询功能,并删除其中的通配符查询词。