public async Task <QueryResult> QueryAsync(ForecastQuery query) { SearchDescriptor <WeatherForecast> esQuery; if (query.Groups?.Count > 0) { esQuery = ConstructAggQuery(query); } else { esQuery = ConstructAllQuery(query); } var s = new SearchDescriptor <WeatherForecast>() .Query(q => q .Bool(b => b .Must(m => m .Term(t => t .Field(f => f.City) .Value("album") )))).Size(10); var result = await _client.SearchAsync <WeatherForecast>(s); return(new QueryResult()); }
private SearchDescriptor <WeatherForecast> ConstructAllQuery(ForecastQuery query) { var s = new SearchDescriptor <WeatherForecast>(); return(s .Query(q => q .Match(m => m .Field(f => f.City) .Query(query.QueryText) )).Size(10)); }
public async Task <QueryResult> QueryGetAsync( string f, string g, string q, int take, string cursor) { // var filters = JsonConvert // .DeserializeObject<Dictionary<string, List<string>>>(f); // var groups = g?.Split(",") ?? new string[0]; // var query = new ForecastQuery() // { // Filters = filters, // Groups = groups.ToList(), // QueryText = q, // Take = take, // Cursor = cursor // }; var query = new ForecastQuery(); return(await QueryAsync(query)); }
public async Task <ActionResult <QueryResult> > Query_Post([FromBody] ForecastQuery query) { return(await _forecastSearch.QueryAsync(query)); }