public SearchResult Search(string index, string type, ElasticQuery elasticQuery) { string[] temp = null; if (type != null) { temp = new[] { type } } ; return(Search(index, temp, elasticQuery)); }
public SearchResult Search(string index, string[] type, ElasticQuery elasticQuery) { string jsonstr = JsonSerializer.Get(elasticQuery); string url; if (type == null || type.Length == 0) { url = "/{0}/_search".Fill(index.ToLower()); } else { url = "/{0}/{1}/_search".Fill(index.ToLower(), string.Join(",", type)); } RestResponse result = _provider.Post(url, jsonstr); var hitResult = new SearchResult(url, jsonstr, result.GetBody()); return(hitResult); }
public SearchResult Search(string index, string[] type, IQuery query, int from, int size, IEnumerable <SortItem> sortItems = null, string[] fields = null) { Contract.Assert(!string.IsNullOrEmpty(index)); Contract.Assert(query != null); Contract.Assert(from >= 0); Contract.Assert(size > 0); var elasticQuery = new ElasticQuery(from, size); elasticQuery.SetQuery(query); if (sortItems != null) { elasticQuery.AddSortItems(sortItems); } if (fields != null) { elasticQuery.AddFields(fields); } return(Search(index, type, elasticQuery)); }
public SearchResult Search(string index, ElasticQuery elasticQuery) { return(Search(index, new string[] {}, elasticQuery)); }