第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

搜索未返回預(yù)期結(jié)果

搜索未返回預(yù)期結(jié)果

守著一只汪 2021-08-13 16:50:45
我正在嘗試連接到 elasticsearch 并在 6.3.2 版本中進行一些基本查詢。我正在嘗試的代碼是這樣的:RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost("localhost", 30100, "http")));SearchRequest sr = new SearchRequest(INDEX);sr.indicesOptions(IndicesOptions.lenientExpandOpen());SearchSourceBuilder ssb = new SearchSourceBuilder();sr.source(ssb);MatchQueryBuilder builder = QueryBuilders.matchQuery("logLevel.keyword", "ERROR");    QueryBuilder qb = QueryBuilders.boolQuery().must(builder);    ssb.query(qb);SearchResponse response = null;try {    response = client.search(sr);    System.out.println("total hits ::: " + response.getHits().getTotalHits());} catch (IOException e) {    e.printStackTrace();} finally {    try {        client.close();    } catch (IOException e) {        e.printStackTrace();    }}System.out.println(response);更新 正如建議的那樣,我現(xiàn)在才使用查詢。我嘗試了來自 API 的構(gòu)建查詢,我看到了結(jié)果,但由于某種原因response.getHits().getTotalHits()返回零。生成的查詢?nèi)缦滤?,并?kibana 中給了我預(yù)期的結(jié)果,即總數(shù)為 1 :GET /_search{  "from": 0,  "query": {    "bool": {      "must": [        {          "match": {            "logLevel.keyword": {              "query": "ERROR",              "operator": "OR",              "prefix_length": 0,              "max_expansions": 50,              "fuzzy_transpositions": true,              "lenient": false,              "zero_terms_query": "NONE",              "auto_generate_synonyms_phrase_query": true,              "boost": 1            }          }        }      ],      "adjust_pure_negative": true,      "boost": 1    }  }}是否缺少 restclient 的一些配置?
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 141 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號