/// <summary>
        /// Create a new SearchRequestFormatter for the given connection, mapping and search request.
        /// </summary>
        /// <param name="connection">The ElasticConnection to prepare the SearchRequest for.</param>
        /// <param name="mapping">The IElasticMapping used to format the SearchRequest.</param>
        /// <param name="searchRequest">The SearchRequest to be formatted.</param>
        public SearchRequestFormatter(IElasticConnection connection, IElasticMapping mapping, SearchRequest searchRequest)
        {
            this.connection = connection;
            this.mapping = mapping;
            this.searchRequest = searchRequest;

            body = new Lazy<string>(() => CreateBody().ToString(connection.Options.Pretty ? Formatting.Indented : Formatting.None));
        }
        public ElasticRequestProcessor(IElasticConnection connection, IElasticMapping mapping, ILog log, IRetryPolicy retryPolicy)
        {
            Argument.EnsureNotNull("connection", connection);
            Argument.EnsureNotNull("mapping", mapping);
            Argument.EnsureNotNull("log", log);
            Argument.EnsureNotNull("retryPolicy", retryPolicy);

            this.connection = connection;
            this.mapping = mapping;
            this.log = log;
            this.retryPolicy = retryPolicy;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ElasticSearchStorage"/> class.
        /// </summary>
        /// <param name="server">The server.</param>
        /// <param name="port">The port.</param>
        public ElasticSearchStorage(string server, int port = 9200)
        {
            // Initialise the LogDelay to be a sensible default if not already set
            if (LogDelay == 0) LogDelay = 60;

            connection = new ElasticConnection(server, port);

            // Subscribe to Log Publishers
            observer = Observable
                .FromEventPattern<Entry>(ev => Log.Entries += ev, ev => Log.Entries -= ev)
                .Select(a => a.EventArgs)
                .Buffer(TimeSpan.FromSeconds(LogDelay))
                .Subscribe(Export);
        }
Ejemplo n.º 4
0
 public BulkRequestLogImporter(IElasticConnection connection)
     : base(connection)
 {
 }
Ejemplo n.º 5
0
 protected ElasticImporter(IElasticConnection connection)
 {
     _connection = connection;
 }