問題:ES查詢時困后,如果有高亮的需求生年,需要小心一點,就是檔文檔字?jǐn)?shù)太多時序攘,高亮?xí)箦e
illegal_argument_exception
在查詢一篇文檔時茴她,使用了高亮請求參數(shù),報錯如下:
The length [5054297] of field [xxxxx.xxxx] in doc[4159]/index[xxxx] exceeds the [index.hightlight.max_analyzed_offset] limit [1000000]. To avoid this error, set the query parameter [max_analyzed_offset] to a value less than index setting [1000000] and this will tolerate long field values by truncating them.
意思是 ES 存在一個限制 index.highlight.max_analyzed_offset
限制程奠,為1000000
這時候需要在查詢中設(shè)置 max_analyzed_offset 參數(shù)為一個小于該值的數(shù)字就可以