SearchHit hit.getSourceAsMap()仅返回10个字段

时间:2019-05-22 07:11:44

标签: java elasticsearch

我使用RestHighLevelClient对索引执行查询,如下所示:

RestHighLevelClient client = new RestHighLevelClient(
            RestClient.builder(new HttpHost(hostname, port, scheme))
                    .setPathPrefix(pathPrefix));
SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);

for (SearchHit hit : searchResponse.getHits()) {
        D dto = (D) objectMapper.readValue(
                hit.getSourceAsString(), //<-- only 10 field in _sources
                params.getDtoClass());

        ((List<D>) result.getResult()).add(dto);}

但是_sources中只有10个字段,某些结果(hit.getSourceAsMap())在调试中监视。

enter image description here

请帮我,哪里出问题了?

查询和参数(来自searchRequest.toString())

SearchRequest{
searchType=QUERY_THEN_FETCH, 
indices=[], 
indicesOptions=IndicesOptions[
ignore_unavailable=false, 
allow_no_indices=true, 
expand_wildcards_open=true, 
expand_wildcards_closed=false, 
allow_aliases_to_multiple_indices=true, 
forbid_closed_indices=true, 
ignore_aliases=false, 
ignore_throttled=true], 
types=[], 
routing='null', 
preference='null', 
requestCache=null, 
scroll=null, 
maxConcurrentShardRequests=0, 
batchedReduceSize=512, 
preFilterShardSize=128, 
allowPartialSearchResults=null, 
localClusterAlias=null, 
getOrCreateAbsoluteStartMillis=-1, 
source={
  "from":0,
  "size":25,
  "query":{
    "bool":{
      "must":[{
        "wildcard":{
          "s_inn":{
            "wildcard":"*111111*","boost":1.0
          }
        }
        },
        {
          "wildcard":{
            "s_ogrn":{
              "wildcard":"*11111*",
              "boost":1.0

            }
          }
        }
        ],
        "adjust_pure_negative":true,
        "boost":1.0
      }
    },
    "highlight":{"fields":{"s_name":{},"s_reg_num":{},"s_ogrn": },"s_inn":{}}}}}

邮递员的此“查询”返回完整的期望字段

enter image description here

0 个答案:

没有答案
相关问题