[英]Elasticsearch validate query API fails for query with highlight
我正在嘗試在我的查詢中使用highlight
,如下所述: https://www.elastic.co/guide/en/elasticsearch/reference/current/highlighting.html 。
此查詢與search
API 一起正常工作,但在實際執行昂貴的查詢之前,我想使用 elasticsearch 提供的驗證 API 對其進行validation
: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-validate .html
但這失敗並顯示錯誤消息:
org.elasticsearch.common.ParsingException: request does not support [highlight]
那么如何在不執行查詢的情況下使用突出顯示來驗證查詢呢?
我在 ES 討論論壇上發現了類似的問題: https://discuss.elastic.co/t/validation-api-got-error-with-highlight-org-elasticsearch-common-parsingexception-request-does-not-support- highlight/248953但它沒有任何解決方案。
它不支持突出顯示(或任何其他參數,如排序、聚合、大小、來自等),因為驗證 API 的目的是驗證您的查詢,並且突出顯示是在執行查詢並從索引獲得響應后完成的.
在不執行的情況下驗證潛在的昂貴查詢。
因此,您可以在運行驗證 API 和驗證查詢時刪除突出顯示。 之后,您可以在實際查詢中添加 highlghtng。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.