コード例 #1
0
        public ISearchResponse <TObject> GetByQuery <TObject>(string indexName,
                                                              Func <QueryContainerDescriptor <TObject>, QueryContainer> query)
            where TObject : class
        {
            ISearchRequest <TObject> Selector(SearchDescriptor <TObject> descriptor)
            {
                return(descriptor
                       .Index(indexName)
                       .Type(GetTypeName <TObject>())
                       .Query(query) as ISearchRequest <TObject>);
            }

            return(Elastic.Search <TObject>(Selector));
        }