国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

ES搜索特殊字符異常Encountered: <EOF> after

這篇具有很好參考價值的文章主要介紹了ES搜索特殊字符異常Encountered: <EOF> after。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報違法"按鈕提交疑問。

異常信息

org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1256)?		... 48 more?	Caused by: org.elasticsearch.client.ResponseException: method 
 
[POST], host [http://xxxxxxurl], URI [/xxxxxxxx/xxxxxxxx/_search?typed_keys=true&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true&sear
ch_type=query_then_fetch&batched_reduce_size=512], status line [HTTP/1.1 400 Bad 
Request]?{"error":{"root_cause":[{"type":"token_mgr_error","reason":"token_mgr_error: 
Lexical error at line 1, column 5.  Encountered: <EOF> after : 
\"\""}],"type":"search_phase_execution_exception","reason":"all shards 
failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"xxxxxxxx","node":"uIjzNu0rRJew8dZu-9nWwA","reason":
{"type":"query_shard_exception","reason":"Failed to parse query [as./]","index_uuid":"uuid","index":"xxxxxxxx","caused_by":{"type":"parse_exception","reason":"parse_exception: Cannot parse 'as./': Lexical error at line 1, column 5.  Encountered: <EOF> after : \"\"","caused_by":{"type":"token_mgr_error","reason":"token_mgr_error: Lexical error at line 1, column 5.  Encountered: <EOF> after : \"\""}}}}]},"status":400}?		at org.elasticsearch.client.RestClient$1.completed(RestClient.java:540)?		at 
org.elasticsearch.client.RestClient$1.completed(RestClient.java:529)?		at 
org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:122)?		at 
org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(Defaul
tClientExchangeHandlerImpl.java:181)?		at 
org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:448)?		at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:338)?		at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265)?		at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)?		at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)?		at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)?		at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)?		at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)?		at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)?		at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)?		at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)?		at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591)?		... 1 more?"

重點(diǎn)是這句

{“type”:“token_mgr_error”,“reason”:“token_mgr_error: Lexical error at line 1, column 5. Encountered: after : “””}

我們在查詢的時候包含特殊字符:“”

所以為了避免搜索出錯,我們需要對查詢的字符串先進(jìn)行轉(zhuǎn)義文章來源地址http://www.zghlxwxcb.cn/news/detail-591269.html

public static String escape(String s) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')' || c == ':'
                    || c == '^' || c == '[' || c == ']' || c == '\"' || c == '{' || c == '}' || c == '~'
                    || c == '*' || c == '?' || c == '|' || c == '&' || c == '/') {
                sb.append('\\');
            }
            sb.append(c);
        }
        return sb.toString();
    }

到了這里,關(guān)于ES搜索特殊字符異常Encountered: <EOF> after的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • ES es Elasticsearch 十三 Java api 實(shí)現(xiàn)搜索 分頁查詢 復(fù)雜查詢 過濾查詢 ids查詢 等

    目錄 Java api 實(shí)現(xiàn)搜索 Pom.xml 建立鏈接 搜索全部記錄 增加規(guī)則值查某些字段 搜索分頁 全代碼 Ids 搜索 搜索Match搜索 multi_match 搜索 多字段搜索 復(fù)雜查詢 bool查詢 filter? bool 復(fù)雜查詢增加過濾器查詢 復(fù)雜擦好像加排序 日志 思路 參考 api 寫法 寫Java代碼 請求條件構(gòu)建層次

    2024年02月04日
    瀏覽(25)
  • ES查詢must_not異常排查

    問題: \\\"error\\\": { \\\"root_cause\\\": [ { \\\"type\\\": \\\"x_content_parse_exception\\\", \\\"reason\\\": \\\"[71:9] [bool] failed to parse field [must_not]\\\" } ], \\\"type\\\": \\\"x_content_parse_exception\\\", \\\"reason\\\": \\\"[71:9] [bool] failed to parse field [must_not]\\\", \\\"caused_by\\\": { \\\"type\\\": \\\"illegal_state_exception\\\", \\\"reason\\\": \\\"expected value but got [START_ARRAY] 根據(jù)提示,發(fā)現(xiàn)查詢

    2024年02月13日
    瀏覽(14)
  • SpringBoot 整合 ES 進(jìn)行各種高級查詢搜索

    SpringBoot 整合 ES 進(jìn)行各種高級查詢搜索

    上一章:《ElasticSearch集群的搭建》 如果你還未安裝es的相關(guān)信息,請先移步至:《ElasticSearch安裝》進(jìn)行安裝 如果您的SpringBoot項(xiàng)目還未整合es,請移步至:《SpringBoot整合ElasticSearch實(shí)現(xiàn)模糊查詢,批量CRUD,排序,分頁,高亮》 同時本文的操作中涉及到ElasticSearchRepository和Ela

    2023年04月15日
    瀏覽(23)
  • MyBatis處理LIKE查詢時,如何將傳值中包含下劃線_和百分號%等特殊字符處理成普通字符而不是SQL的單字符通配符

    MySQL中,_和%在LIKE模糊匹配中有特殊的含義: 下劃線?_?在LIKE模糊匹配中表示匹配任意單個字符。 百分號?%?在LIKE模糊匹配中表示匹配任意多個字符(包括零個字符) 如果這種字符不經(jīng)過處理,并且你的模糊查詢sql語句書寫如下,那么在你的前端頁面搜索框中輸入下劃線或

    2024年01月23日
    瀏覽(28)
  • elasticsearch(ES)分布式搜索引擎03——(RestClient查詢文檔,ES旅游案例實(shí)戰(zhàn))

    elasticsearch(ES)分布式搜索引擎03——(RestClient查詢文檔,ES旅游案例實(shí)戰(zhàn))

    文檔的查詢同樣適用昨天學(xué)習(xí)的 RestHighLevelClient對象,基本步驟包括: 1)準(zhǔn)備Request對象 2)準(zhǔn)備請求參數(shù) 3)發(fā)起請求 4)解析響應(yīng) 我們以match_all查詢?yōu)槔?3.1.1.發(fā)起查詢請求 代碼解讀: 第一步,創(chuàng)建 SearchRequest 對象,指定索引庫名 第二步,利用 request.source() 構(gòu)建DSL,DSL中可

    2024年02月07日
    瀏覽(26)
  • ElasticSearch系列 - SpringBoot整合ES之全文搜索匹配查詢 match

    官方文檔地址:https://www.elastic.co/guide/en/elasticsearch/reference/index.html 權(quán)威指南:https://www.elastic.co/guide/cn/elasticsearch/guide/current/structured-search.html 1. 數(shù)據(jù)準(zhǔn)備 官方測試數(shù)據(jù)下載地址:https://download.elastic.co/demos/kibana/gettingstarted/accounts.zip ,數(shù)據(jù)量很大,我們自己構(gòu)造數(shù)據(jù)吧。 2. m

    2023年04月08日
    瀏覽(33)
  • Es索引中時間字段是字符串Range查詢的正確姿勢

    Es索引中時間字段是字符串Range查詢的正確姿勢

    ? ? 由于之前搞了一個使用flink-cdc將mysql表中的數(shù)據(jù)同步到es的索引中,例子中數(shù)據(jù)庫中的orders表中的order_date的字段類型是datetime類型,flink-sql建表orders、enriched_orders中的order_date 字段是TIMESTAMP(0)類型,同步到es的enriched_orders索引中的order_date的類型是: ? ? 數(shù)據(jù)被同步到e

    2024年02月11日
    瀏覽(19)
  • 第七章-分布式搜索引擎-ES:全文查詢、分詞查詢、精確查詢、地理坐標(biāo)查詢、組合查詢(bool、funtion_score)以及RestApi

    第七章-分布式搜索引擎-ES:全文查詢、分詞查詢、精確查詢、地理坐標(biāo)查詢、組合查詢(bool、funtion_score)以及RestApi

    DSL查詢分類 全文查詢、分詞查詢、非分詞查詢、地理坐標(biāo)查詢、組合查詢 match_all 查詢所有,不需要查詢條件,固定寫法_search 第一個hits就是命中的數(shù)據(jù)?,total就是條數(shù),第二個hits是source嘞 ? 全文檢索查詢 我們不要整多個字段查詢,參與的字段越多,查詢速度越慢,如果有

    2024年01月16日
    瀏覽(33)
  • Elasticsearch實(shí)戰(zhàn)(十七)---ES搜索如何使用In操作查詢及如何Distinct去除重復(fù)數(shù)據(jù)

    Elasticsearch實(shí)戰(zhàn)(十七)---ES搜索如何使用In操作查詢及如何Distinct去除重復(fù)數(shù)據(jù)

    Elasticsearch實(shí)戰(zhàn)-ES搜索如何使用In操作查詢filter過濾及如何Distinct去除重復(fù)數(shù)據(jù) 場景: ES搜索, 獲取手機(jī)號是 19000001111 或者 19000003333 后者 19000004444 的人, 并且 性別是男, 且 年齡是[20-30]的人,這種查詢用mysql 如何實(shí)現(xiàn) ? 在mysql中會用in查詢, 但是在ES中 我們實(shí)現(xiàn)就是 term

    2023年04月09日
    瀏覽(20)
  • es 中文前綴短語匹配(搜索智能補(bǔ)全) prefix查詢和completion suggester兩種方式

    需求 :es進(jìn)行前綴匹配,用來進(jìn)行智能補(bǔ)全 方式一:正常索引庫類型,字段類型為text 過程 :es正常的prefix只能進(jìn)行詞語匹配,而中文的分詞大部分按字分詞,不按語義分詞,所以無法搜索出正確的前綴匹配,而能進(jìn)行短語匹配的match_phrase_prefix匹配,是正常按前幾個詞進(jìn)行匹

    2024年01月24日
    瀏覽(24)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包