Search all docs into index in nest 2.1.1

hi, this code returns only 10 docs

ISearchResponse result = elasticClient.Search
(
x => x.MatchAll()
);

this one throw exception 500

ISearchResponse result = elasticClient.Search
(
x => x.MatchAll().From(0).Size(int.MaxValue)
);

Thanks.

Hey,

can you show us the exception in the elasticsearch logs or error message returned by elasticsearch? A 500 error usually indicates that elasticsearch threw an exception.

--Alex

this is the result.ApiCall.ToString()

{Unsuccessful low level call on POST: /push_analizer_ita/doc/_search}
[Elasticsearch.Net.ElasticsearchResponse<Nest.SearchResponse<TestIndiciFisco.Doc>>]: {Unsuccessful low level call on POST: /push_analizer_ita/doc/_search}
AuditTrail: Count = 2
DebugInformation: "Unsuccessful low level call on POST: /push_analizer_ita/doc/_search\r\n# Audit trail of this API call:\r\n - PingSuccess: Node: http://x.x.x.x:9201/ Took: 00:00:01.2160000\r\n - BadResponse: Node: http://x.x.x.x:9201/ Took: 00:00:08.5010000\r\n# ServerError: ServerError: 500Type: search_phase_execution_exception Reason: "all shards failed"\r\n# OriginalException: System.Net.WebException: Errore del server remoto: (500) Errore interno del server.\r\n in System.Net.HttpWebRequest.GetResponse()\r\n in Elasticsearch.Net.HttpConnection.Request[TReturn](RequestData requestData)\r\n# Request:\r\n<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>\r\n# Response:\r\n<Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>\r\n"
HttpMethod: POST
HttpStatusCode: 500
OriginalException: {"Errore del server remoto: (500) Errore interno del server."}
RequestBodyInBytes: null
ResponseBodyInBytes: null
ServerError: {ServerError: 500Type: search_phase_execution_exception Reason: "all shards failed"}
Success: false
Uri: {http://x.x.x.x:9201/push_analizer_ita/doc/_search}

Hey,

so this means that a regular /_search operation against Elasticsearch should also fail? You can try using curl or a browser. If so, you should check your elasticsearch log files, whats up.

This is not a nest issue.

--Alex

i found the problem using fiddler.

post:
http://x.x.x.x:9201/push_analizer_ita/doc/_search

response:
{"error":{"root_cause":[{"type":"query_phase_execution_exception","reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [2147483647]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level parameter."}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"push_analizer_ita","node":"XKuEFgr8REekdDx6s9n0qQ","reason":{"type":"query_phase_execution_exception","reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [2147483647]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level parameter."}}]},"status":500}