Exemplo n.º 1
0
        public async Task <ResultDetails <SearchResult <T> > > PostSearchAsync <T>(string jsonContent, string scrollId,
                                                                                   ScanAndScrollConfiguration scanAndScrollConfiguration, SearchUrlParameters searchUrlParameters)
        {
            _traceProvider.Trace(TraceEventType.Verbose, "{2}: Request for search: {0}, content: {1}", typeof(T),
                                 jsonContent, "Search");

            var urlParams = "";

            if (searchUrlParameters != null)
            {
                urlParams = searchUrlParameters.GetUrlParameters();
            }
            var elasticSearchMapping =
                _elasticSerializerConfiguration.ElasticMappingResolver.GetElasticSearchMapping(typeof(T));
            var elasticUrlForEntityGet = string.Format("{0}/{1}/{2}/_search{3}", _connectionString,
                                                       elasticSearchMapping.GetIndexForType(typeof(T)), elasticSearchMapping.GetDocumentType(typeof(T)),
                                                       urlParams);

            if (!string.IsNullOrEmpty(scrollId))
            {
                elasticUrlForEntityGet = string.Format("{0}/{1}{2}", _connectionString,
                                                       scanAndScrollConfiguration.GetScrollScanUrlForRunning(), scrollId);
            }

            var uri = new Uri(elasticUrlForEntityGet);

            var result = await PostInteranlSearchAsync <T>(jsonContent, uri);

            return(result);
        }
Exemplo n.º 2
0
        public ResultDetails <SearchResult <T> > PostSearchCreateScanAndScroll <T>(string jsonContent,
                                                                                   ScanAndScrollConfiguration scanAndScrollConfiguration)
        {
            var syncExecutor = new SyncExecute(_traceProvider);

            return(syncExecutor.ExecuteResultDetails(
                       () => PostSearchCreateScanAndScrollAsync <T>(jsonContent, scanAndScrollConfiguration)));
        }
Exemplo n.º 3
0
        public ResultDetails <SearchResult <T> > PostSearch <T>(string jsonContent, string scrollId,
                                                                ScanAndScrollConfiguration scanAndScrollConfiguration, SearchUrlParameters searchUrlParameters)
        {
            var syncExecutor = new SyncExecute(_traceProvider);

            return(syncExecutor.ExecuteResultDetails(
                       () => PostSearchAsync <T>(jsonContent, scrollId, scanAndScrollConfiguration, searchUrlParameters)));
        }
Exemplo n.º 4
0
        public async Task <ResultDetails <SearchResult <T> > > PostSearchCreateScanAndScrollAsync <T>(string jsonContent,
                                                                                                      ScanAndScrollConfiguration scanAndScrollConfiguration)
        {
            _traceProvider.Trace(TraceEventType.Verbose,
                                 "{2}: Request for search create scan ans scroll: {0}, content: {1}", typeof(T), jsonContent, "Search");

            var elasticSearchMapping =
                _elasticSerializerConfiguration.ElasticMappingResolver.GetElasticSearchMapping(typeof(T));
            var elasticUrlForEntityGet = string.Format("{0}/{1}/{2}/_search", _connectionString,
                                                       elasticSearchMapping.GetIndexForType(typeof(T)), elasticSearchMapping.GetDocumentType(typeof(T)));

            elasticUrlForEntityGet = elasticUrlForEntityGet + "?" +
                                     scanAndScrollConfiguration.GetScrollScanUrlForSetup();

            var uri    = new Uri(elasticUrlForEntityGet);
            var result = await PostInteranlSearchAsync <T>(jsonContent, uri);

            return(result);
        }