Skip to content

TrackTotalHits is ignored during MultiSearch call #3906

Closed
@uveta

Description

@uveta

NEST/Elasticsearch.Net version:
7.0.0

Elasticsearch version:
7.1.0

Description of the problem including expected versus actual behavior:
When using TrackTotalHits as part of query in multisearch request, the setting is not propagated to track_total_hits when calling ElasticSearch API. When I send individual requests the setting is propagated correctly.

Here is a code snippet of how I am creating multisearch request.

var multiSearchRequest = new MultiSearchRequest(Infer.Index("catalog"))
{
  CcsMinimizeRoundtrips = true,
  Operations = classes.ToDictionary(c => c.ToString(),
    c => (ISearchRequest) new SearchRequest<ToolModel>
    {
      Size = 0,
      Source = false,
      TrackTotalHits = true,
      Query = new BoolQuery
      {
        Must = new List<QueryContainer>
        {
          conditions,
          new MatchQuery
          {
            Field = Infer.Field<ToolModel>(tool => tool.Class.All),
            Query = c
          }
        }
      }
    })
};

Provide DebugInformation (if relevant):
DebugInformation obtained from sending 6 requests as part of multisearch:

Valid NEST response built from a successful (200) low level call on POST: /catalog/_msearch?typed_keys=true&ccs_minimize_roundtrips=true
Audit trail of this API call:
[1] HealthyResponse: Node: http://*:9200/ Took: 00:00:00.1083228

Request:
{}
{"query":{"bool":{"must":[{"bool":{"must":[{"match":{"synchronization_id":{"query":"5ad7adf87a4c44d7b3c00be3e49c8376"}}},{"bool":{"should":[{"match":{"gtc_class.all":{"query":"CTL"}}}]}}]}},{"match":{"gtc_class.all":{"query":"TL"}}}]}},"size":0,"_source":false}
{}
{"query":{"bool":{"must":[{"bool":{"must":[{"match":{"synchronization_id":{"query":"5ad7adf87a4c44d7b3c00be3e49c8376"}}},{"bool":{"should":[{"match":{"gtc_class.all":{"query":"CTL"}}}]}}]}},{"match":{"gtc_class.all":{"query":"ADP"}}}]}},"size":0,"_source":false}
{}
{"query":{"bool":{"must":[{"bool":{"must":[{"match":{"synchronization_id":{"query":"5ad7adf87a4c44d7b3c00be3e49c8376"}}},{"bool":{"should":[{"match":{"gtc_class.all":{"query":"CTL"}}}]}}]}},{"match":{"gtc_class.all":{"query":"INS"}}}]}},"size":0,"_source":false}
{}
{"query":{"bool":{"must":[{"bool":{"must":[{"match":{"synchronization_id":{"query":"5ad7adf87a4c44d7b3c00be3e49c8376"}}},{"bool":{"should":[{"match":{"gtc_class.all":{"query":"CTL"}}}]}}]}},{"match":{"gtc_class.all":{"query":"ASY"}}}]}},"size":0,"_source":false}
{}
{"query":{"bool":{"must":[{"bool":{"must":[{"match":{"synchronization_id":{"query":"5ad7adf87a4c44d7b3c00be3e49c8376"}}},{"bool":{"should":[{"match":{"gtc_class.all":{"query":"CTL"}}}]}}]}},{"match":{"gtc_class.all":{"query":"ACC"}}}]}},"size":0,"_source":false}
{}
{"query":{"bool":{"must":[{"bool":{"must":[{"match":{"synchronization_id":{"query":"5ad7adf87a4c44d7b3c00be3e49c8376"}}},{"bool":{"should":[{"match":{"gtc_class.all":{"query":"CTL"}}}]}}]}},{"match":{"gtc_class.all":{"query":"CTL"}}}]}},"size":0,"_source":false}

Response:
{"took":7,"responses":[{"took":0,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":10000,"relation":"gte"},"max_score":null,"hits":[]},"status":200},{"took":6,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":5053,"relation":"eq"},"max_score":null,"hits":[]},"status":200},{"took":0,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":10000,"relation":"gte"},"max_score":null,"hits":[]},"status":200},{"took":0,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":0,"relation":"eq"},"max_score":null,"hits":[]},"status":200},{"took":0,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":0,"relation":"eq"},"max_score":null,"hits":[]},"status":200},{"took":3,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":10000,"relation":"gte"},"max_score":null,"hits":[]},"status":200}]}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions