Exemplo n.º 1
0
		/// <summary>
		/// The count API allows to easily execute a query and get the number of matches for that query. 
		/// It can be executed across one or more indices and across one or more types. 
		/// <para>This overload returns a dynamic response and defaults to all types and indices</para>
		/// <para> </para>>http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-count.html
		/// </summary>
		/// <param name="client"></param>
		/// <param name="countSelector">An optional descriptor to describe the count operation</param>
		public static Task<ICountResponse> CountAsync(this IElasticClient client,
			Func<CountDescriptor<dynamic>, CountDescriptor<dynamic>> countSelector = null)
		{
			countSelector = countSelector ?? (s => s);
			return client.CountAsync<dynamic>(c => countSelector(c.AllIndices().AllTypes()));
		}
 /// <summary>
 /// Queries the number of documents in the Azure Search index.  (see
 /// https://msdn.microsoft.com/library/azure/dn798939.aspx for more
 /// information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.Azure.Search.IDocumentOperations.
 /// </param>
 /// <returns>
 /// Response containing the count of documents in the index.
 /// </returns>
 public static Task<DocumentCountResponse> CountAsync(this IDocumentOperations operations)
 {
     return operations.CountAsync(CancellationToken.None);
 }