Пример #1
0
		public void SimplePutAndGet()
		{
			var putResponse = this.Client.PutWarmer("warmer_simpleputandget", wd => wd
				.Type<ElasticsearchProject>()
				.Search<ElasticsearchProject>(s => s
					.Query(q => q
						.Terms(p => p.Name, new [] {"strange-value"})
					)
				//.Filter(filter => filter)  // this is why there is a search descriptor
				)
			);
			Assert.IsTrue(putResponse.Acknowledged);

			var warmerResponse = this.Client.GetWarmer("warmer_simpleputandget", wd => wd
				.Index<ElasticsearchProject>()
			   );

			warmerResponse.Should().NotBeNull();
			warmerResponse.IsValid.Should().BeTrue();
			warmerResponse.Indices.Should().NotBeNull();
			warmerResponse.Indices.Should().ContainKey(Settings.DefaultIndex);
			warmerResponse.Indices[Settings.DefaultIndex].Should().ContainKey("warmer_simpleputandget");
			var warmerMapping = warmerResponse.Indices[Settings.DefaultIndex]["warmer_simpleputandget"];
			warmerMapping.Name.Should().Be("warmer_simpleputandget");
			var typeName = Client.Infer.TypeName<ElasticsearchProject>();
			var typeNames = new ElasticInferrer(Settings).TypeNames(warmerMapping.Types);
			typeNames.Contains(typeName).Should().Be(true);
			//warmerMapping.Source.Should().Contain("\"strange-value\"");
		}
Пример #2
0
        public void SimplePutAndGet()
        {
            var putResponse = this._client.PutWarmer("warmer_simpleputandget", wd => wd
                                                     .Type <ElasticsearchProject>()
                                                     .Search <ElasticsearchProject>(s => s
                                                                                    .Query(q => q
                                                                                           .Terms(p => p.Name, "strange-value")
                                                                                           )
                                                                                    //.Filter(filter => filter)  // this is why there is a search descriptor
                                                                                    )
                                                     );

            Assert.IsTrue(putResponse.Acknowledged);

            var warmerResponse = this._client.GetWarmer("warmer_simpleputandget", wd => wd
                                                        .Index <ElasticsearchProject>()
                                                        );

            warmerResponse.Should().NotBeNull();
            warmerResponse.IsValid.Should().BeTrue();
            warmerResponse.Indices.Should().NotBeNull();
            warmerResponse.Indices.Should().ContainKey(_settings.DefaultIndex);
            warmerResponse.Indices[_settings.DefaultIndex].Should().ContainKey("warmer_simpleputandget");
            var warmerMapping = warmerResponse.Indices[_settings.DefaultIndex]["warmer_simpleputandget"];

            warmerMapping.Name.Should().Be("warmer_simpleputandget");
            var typeName  = _client.Infer.TypeName <ElasticsearchProject>();
            var typeNames = new ElasticInferrer(_settings).TypeNames(warmerMapping.Types);

            typeNames.Contains(typeName).Should().Be(true);
            //warmerMapping.Source.Should().Contain("\"strange-value\"");
        }
Пример #3
0
 public PutMappingDescriptor(IConnectionSettingsValues connectionSettings)
 {
     this._connectionSettings = connectionSettings;
     this._infer  = new ElasticInferrer(this._connectionSettings);
     Self.Mapping = new RootObjectMapping()
     {
     };
 }
Пример #4
0
 public ObjectMappingDescriptor(IConnectionSettingsValues connectionSettings)
 {
     this._TypeName = TypeNameMarker.Create <TChild>();
     this._Mapping  = new ObjectMapping()
     {
     };
     this._connectionSettings = connectionSettings;
     this.Infer = new ElasticInferrer(this._connectionSettings);
 }
Пример #5
0
        public void AttributeTypeNamesTakePrecedenceOverDefaultTypeNameInferrer()
        {
            var clientSettings = new ConnectionSettings(Test.Default.Uri, "mydefaultindex")
                                 .SetDefaultTypeNameInferrer(t => t.Name.ToUpperInvariant())
            ;

            var            inferrer = new ElasticInferrer(clientSettings);
            TypeNameMarker marker   = typeof(MyCustomAtrributeName);

            inferrer.TypeName(marker).Should().Be("custotypo");
        }
Пример #6
0
        public void MapTypeIndicesTakesPrecedenceOverAttributeName()
        {
            var clientSettings = new ConnectionSettings(Test.Default.Uri, "mydefaultindex")
                                 .MapDefaultTypeNames(dt => dt
                                                      .Add(typeof(MyCustomAtrributeName), "micutype")
                                                      )
                                 .SetDefaultTypeNameInferrer(t => t.Name.ToUpperInvariant())
            ;

            var            inferrer = new ElasticInferrer(clientSettings);
            TypeNameMarker marker   = typeof(MyCustomAtrributeName);

            inferrer.TypeName(marker).Should().Be("micutype");
        }
Пример #7
0
 public static void Update(IConnectionSettingsValues settings, ElasticsearchPathInfo <IndicesStatsRequestParameters> pathInfo, IIndicesStatsRequest request)
 {
     if (request.Types.HasAny())
     {
         var inferrer = new ElasticInferrer(settings);
         var types    = inferrer.TypeNames(request.Types);
         pathInfo.RequestParameters.AddQueryString("types", string.Join(",", types));
     }
     if (request.Metrics != null)
     {
         pathInfo.Metric = request.Metrics.Cast <Enum>().GetStringValue();
     }
     pathInfo.HttpMethod = PathInfoHttpMethod.GET;
 }
Пример #8
0
        public void CreateIndexMultiFieldMap()
        {
            var client = this.Client;

            var typeMapping = new RootObjectMapping();

            typeMapping.Name = Guid.NewGuid().ToString("n");
            var property = new MultiFieldMapping();

            var primaryField = new StringMapping()
            {
                Index = FieldIndexOption.NotAnalyzed
            };

            var analyzedField = new StringMapping()
            {
                Index = FieldIndexOption.Analyzed
            };

            property.Fields.Add("name", primaryField);
            property.Fields.Add("name_analyzed", analyzedField);
            typeMapping.Properties = typeMapping.Properties ?? new Dictionary <PropertyNameMarker, IElasticType>();
            typeMapping.Properties.Add("name", property);

            var settings = new IndexSettings();

            settings.Mappings.Add(typeMapping);
            settings.NumberOfReplicas = 1;
            settings.NumberOfShards   = 5;
            settings.Analysis.Analyzers.Add("snowball", new SnowballAnalyzer {
                Language = "English"
            });

            var indexName = Guid.NewGuid().ToString();
            var response  = client.CreateIndex(indexName, i => i.InitializeUsing(settings));

            Assert.IsTrue(response.IsValid);
            Assert.IsTrue(response.Acknowledged);

            var inferrer = new ElasticInferrer(this.Settings);
            var typeName = inferrer.PropertyName(typeMapping.Name);

            Assert.IsNotNull(this.Client.GetMapping <ElasticsearchProject>(gm => gm.Index(indexName).Type(typeName)));

            var deleteResponse = client.DeleteIndex(i => i.Index(indexName));

            Assert.IsTrue(deleteResponse.IsValid);
            Assert.IsTrue(deleteResponse.Acknowledged);
        }
Пример #9
0
        public static void SetRouteParameters <TParameters>(
            IIndexPath <TParameters> path,
            IConnectionSettingsValues settings,
            ElasticsearchPathInfo <TParameters> pathInfo)
            where TParameters : IRequestParameters, new()
        {
            if (path.Index == null)
            {
                throw new DslException("missing index route parameter");
            }

            var index = new ElasticInferrer(settings).IndexName(path.Index);

            pathInfo.Index = index;
        }
        public static void SetRouteParameters <TParameters, T>(
            IIndexNamePath <TParameters> path,
            IConnectionSettingsValues settings,
            ElasticsearchPathInfo <TParameters> pathInfo)
            where TParameters : IRequestParameters, new()
            where T : class
        {
            if (path.Name == null)
            {
                throw new DslException("missing name route parameter");
            }
            var inferrer = new ElasticInferrer(settings);
            var index    = inferrer.IndexName(path.Index) ?? inferrer.IndexName(typeof(T)) ?? inferrer.DefaultIndex;

            pathInfo.Index = index;
            pathInfo.Name  = path.Name;
        }
Пример #11
0
        public void DefaultTypeNamesTakePrecedenceOverCustomTypeNameInferrer()
        {
            var clientSettings = new ConnectionSettings(Test.Default.Uri, "mydefaultindex")
                                 .MapDefaultTypeNames(p => p
                                                      .Add(typeof(Developer), "codemonkey")
                                                      )
                                 .SetDefaultTypeNameInferrer(t => t.Name.ToUpperInvariant())
            ;

            var            inferrer = new ElasticInferrer(clientSettings);
            TypeNameMarker marker   = typeof(Developer);

            inferrer.TypeName(marker).Should().Be("codemonkey");

            //Should use the custom type name inferrer that upper cases
            marker = typeof(NoopObject);
            inferrer.TypeName(marker).Should().Be("NOOPOBJECT");
        }
Пример #12
0
        public PutTemplateDescriptor AddMapping <T>(Func <PutMappingDescriptor <T>, PutMappingDescriptor <T> > mappingSelector)
            where T : class
        {
            mappingSelector.ThrowIfNull("mappingSelector");
            var putMappingDescriptor = mappingSelector(new PutMappingDescriptor <T>(this._connectionSettings));

            putMappingDescriptor.ThrowIfNull("rootObjectMappingDescriptor");

            var inferrer = new ElasticInferrer(this._connectionSettings);
            IPutMappingRequest request = putMappingDescriptor;
            var typeName = inferrer.TypeName(request.Type ?? typeof(T));

            if (typeName == null)
            {
                return(this);
            }
            Self.TemplateMapping.Mappings[typeName] = request.Mapping;
            return(this);
        }
Пример #13
0
        /// <summary>
        /// Instantiate a new strongly typed connection to elasticsearch
        /// </summary>
        /// <param name="settings">An optional settings object telling the client how and where to connect to.
        /// <para>Defaults to a static single node connection pool to http://localhost:9200</para>
        /// <para>It's recommended to pass an explicit 'new ConnectionSettings()' instance</para>
        /// </param>
        /// <param name="connection">Optionally provide a different connection handler, defaults to http using HttpWebRequest</param>
        /// <param name="serializer">Optionally provide a custom serializer responsible for taking a stream and turning into T</param>
        /// <param name="transport">The transport coordinates requests between the client and the connection pool and the connection</param>
        public ElasticClient(
            IConnectionSettingsValues settings = null,
            IConnection connection             = null,
            INestSerializer serializer         = null,
            ITransport transport = null)
        {
            this._connectionSettings = settings ?? new ConnectionSettings();
            this.Connection          = connection ?? new HttpConnection(this._connectionSettings);

            this.Serializer = serializer ?? new NestSerializer(this._connectionSettings);
            this.Raw        = new ElasticsearchClient(
                this._connectionSettings,
                this.Connection,
                transport,                 //default transport
                this.Serializer
                );
            this.RawDispatch = new RawDispatch(this.Raw);
            this.Infer       = this._connectionSettings.Inferrer;
        }
Пример #14
0
        public static void SetRouteParameters <TParameters, T>(
            IQueryPath <TParameters> path,
            IConnectionSettingsValues settings,
            ElasticsearchPathInfo <TParameters> pathInfo)
            where TParameters : IRequestParameters, new()
            where T : class
        {
            //start out with defaults
            var inferrer = new ElasticInferrer(settings);


            var index = inferrer.IndexName <T>();
            var type  = inferrer.TypeName <T>();

            pathInfo.Index = index;
            pathInfo.Type  = type;

            if (path.Types.HasAny())
            {
                pathInfo.Type = inferrer.TypeNames(path.Types);
            }
            else if (path.AllTypes.GetValueOrDefault(false))
            {
                pathInfo.Type = null;
            }
            else
            {
                pathInfo.Type = inferrer.TypeName <T>();
            }

            if (path.Indices.HasAny())
            {
                pathInfo.Index = inferrer.IndexNames(path.Indices);
            }
            else if (path.AllIndices.GetValueOrDefault(false) && !pathInfo.Type.IsNullOrEmpty())
            {
                pathInfo.Index = "_all";
            }
            else
            {
                pathInfo.Index = path.AllIndices.GetValueOrDefault(false) ? null : inferrer.IndexName <T>();
            }
        }
Пример #15
0
		/// <summary>
		/// Based on the type information present in this descriptor create method that takes
		/// the returned _source and hit and returns the ClrType it should deserialize too.
		/// This is so that Documents[A] can contain actual instances of subclasses B, C as well.
		/// If you specify types using .Types(typeof(B), typeof(C)) then NEST can automagically
		/// create a TypeSelector based on the hits _type property.
		/// </summary>
		public static void CloseOverAutomagicCovariantResultSelector(ElasticInferrer infer, ICovariantSearchRequest self)
		{
			if (infer == null || self == null) return;
			var returnType = self.ClrType;

			if (returnType == null) return;

			var types = self.ElasticsearchTypes?.Match(all => new TypeName[] { "_all" }, many => many.Types);
			types = (types ?? Enumerable.Empty<TypeName>()).Where(t => t.Type != null).ToList();

			if (self.TypeSelector != null || !types.HasAny(t => t.Type != returnType))
				return;

			var typeDictionary = types.ToDictionary(infer.TypeName, t => t.Type);
			self.TypeSelector = (o, h) =>
			{
				Type t;
				return !typeDictionary.TryGetValue(h.Type, out t) ? returnType : t;
			};
		}
        public static void SetRouteParameters <TParameters>(
            IIndicesTypePath <TParameters> path,
            IConnectionSettingsValues settings,
            ElasticsearchPathInfo <TParameters> pathInfo)
            where TParameters : IRequestParameters, new()
        {
            var inferrer = new ElasticInferrer(settings);

            var index = !path.Indices.HasAny()
                                ? null
                                : string.Join(",", path.Indices.Select(inferrer.IndexName));

            if (path.AllIndices.GetValueOrDefault(false))
            {
                index = "_all";
            }

            var type = inferrer.TypeName(path.Type);

            pathInfo.Index = index;
            pathInfo.Type  = type;
        }
Пример #17
0
        public static void SetRouteParameters <TParameters>(
            IIndexOptionalPath <TParameters> path,
            IConnectionSettingsValues settings,
            ElasticsearchPathInfo <TParameters> pathInfo)
            where TParameters : IRequestParameters, new()
        {
            var inferrer = new ElasticInferrer(settings);

            if (!path.AllIndices.HasValue && path.Index == null)
            {
                path.Index = inferrer.DefaultIndex;
            }

            string index = null;

            if (!path.AllIndices.GetValueOrDefault(false))
            {
                index = inferrer.IndexName(path.Index);
            }

            pathInfo.Index = index;
        }
Пример #18
0
        public void ResolveToSepcifiedTypeNames()
        {
            var clientSettings = new ConnectionSettings(Test.Default.Uri, "mydefaultindex")
                                 .MapDefaultTypeNames(p => p
                                                      .Add(typeof(Car), "automobile")
                                                      .Add(typeof(Person), "human")
                                                      .Add(typeof(Organization), "organisation")
                                                      .Add(typeof(Developer), "codemonkey")
                                                      .Add(typeof(MyGeneric <Developer>), "codemonkey-wrapped-in-bacon")
                                                      .Add(typeof(MyGeneric <Organization>), "org-wrapped-in-bacon")
                                                      );
            var inferrer = new ElasticInferrer(clientSettings);

            TypeNameMarker marker = typeof(Car);

            inferrer.TypeName(marker).Should().Be("automobile");

            marker = typeof(Person);
            inferrer.TypeName(marker).Should().Be("human");

            marker = typeof(Organization);
            inferrer.TypeName(marker).Should().Be("organisation");

            marker = typeof(Developer);
            inferrer.TypeName(marker).Should().Be("codemonkey");

            marker = typeof(MyGeneric <Developer>);
            inferrer.TypeName(marker).Should().Be("codemonkey-wrapped-in-bacon");

            marker = typeof(MyGeneric <Organization>);
            inferrer.TypeName(marker).Should().Be("org-wrapped-in-bacon");

            //Should fall back to the default lowercase since
            //it doesn't have an explicit default
            marker = typeof(NoopObject);
            inferrer.TypeName(marker).Should().Be("noopobject");
        }
        public static void SetRouteParameters <TParameters>(
            IIndicesOptionalExplicitAllPath <TParameters> path,
            IConnectionSettingsValues settings,
            ElasticsearchPathInfo <TParameters> pathInfo)
            where TParameters : IRequestParameters, new()
        {
            var inferrer = new ElasticInferrer(settings);

            if (!path.AllIndices.HasValue && path.Indices == null)
            {
                path.Indices = new[] { (IndexNameMarker)inferrer.DefaultIndex }
            }
            ;

            string index = "_all";

            if (!path.AllIndices.GetValueOrDefault(false))
            {
                index = string.Join(",", path.Indices.Select(inferrer.IndexName));
            }

            pathInfo.Index = index;
        }
    }
        public static void SetRouteParameters <TParameters>(
            IIndexTypePath <TParameters> path,
            IConnectionSettingsValues settings,
            ElasticsearchPathInfo <TParameters> pathInfo)
            where TParameters : IRequestParameters, new()
        {
            var inferrer = new ElasticInferrer(settings);

            if (path.Index == null)
            {
                throw new DslException("Index() not specified");
            }

            if (path.Type == null)
            {
                throw new DslException("Type() not specified");
            }

            var index = inferrer.IndexName(path.Index);
            var type  = inferrer.TypeName(path.Type);

            pathInfo.Index = index;
            pathInfo.Type  = type;
        }
Пример #21
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (this._settings == null)
            {
                var elasticContractResolver = serializer.ContractResolver as ElasticContractResolver;
                if (elasticContractResolver == null)
                {
                    return new MultiSearchResponse {
                               IsValid = false
                    }
                }
                ;
                var piggyBackState = elasticContractResolver.PiggyBackState;
                if (piggyBackState == null || piggyBackState.ActualJsonConverter == null)
                {
                    return new MultiSearchResponse {
                               IsValid = false
                    }
                }
                ;

                var realConverter = piggyBackState.ActualJsonConverter as MultiSearchConverter;
                if (realConverter == null)
                {
                    return new MultiSearchResponse {
                               IsValid = false
                    }
                }
                ;

                var mr = realConverter.ReadJson(reader, objectType, existingValue, serializer) as MultiSearchResponse;
                return(mr);
            }


            var response   = new MultiSearchResponse();
            var jsonObject = JObject.Load(reader);

            var docsJarray = (JArray)jsonObject["responses"];

            if (docsJarray == null)
            {
                return(response);
            }
            var multiSearchDescriptor = this._descriptor;

            if (this._descriptor == null)
            {
                return(multiSearchDescriptor);
            }

            var withMeta = docsJarray.Zip(this._descriptor._Operations, (doc, desc) => new MultiHitTuple {
                Hit = doc, Descriptor = desc
            });
            var originalResolver = serializer.ContractResolver;

            foreach (var m in withMeta)
            {
                var descriptor           = m.Descriptor.Value;
                var concreteTypeSelector = descriptor._ConcreteTypeSelector;
                var baseType             = m.Descriptor.Value._ClrType;
                var types = m.Descriptor.Value._Types.EmptyIfNull().ToList();

                //if we dont already have a concrete type converter but we have selected more types then
                //just the base return type automagically create our own concrete type converter
                if (concreteTypeSelector == null &&
                    types.HasAny() &&
                    types.Count() > types.Count(x => x.Type == baseType))
                {
                    var inferrer = new ElasticInferrer(this._settings);

                    var typeDict = types.ToDictionary(inferrer.TypeName, t => t.Type);
                    concreteTypeSelector = (o, h) =>
                    {
                        Type t;
                        return(!typeDict.TryGetValue(h.Type, out t) ? baseType : t);
                    };
                }
                var generic = MakeDelegateMethodInfo.MakeGenericMethod(baseType);

                if (concreteTypeSelector != null)
                {
                    var elasticSerializer = new NestSerializer(this._settings);
                    var state             = typeof(ConcreteTypeConverter <>).CreateGenericInstance(baseType, concreteTypeSelector) as JsonConverter;
                    if (state != null)
                    {
                        var settings = elasticSerializer.CreateSettings(piggyBackJsonConverter: state);

                        var jsonSerializer = new JsonSerializer()
                        {
                            NullValueHandling    = settings.NullValueHandling,
                            DefaultValueHandling = settings.DefaultValueHandling,
                            ContractResolver     = settings.ContractResolver,
                        };
                        foreach (var converter in settings.Converters.EmptyIfNull())
                        {
                            jsonSerializer.Converters.Add(converter);
                        }
                        generic.Invoke(null, new object[] { m, jsonSerializer, response._Responses, this._settings });
                        continue;
                    }
                }
                generic.Invoke(null, new object[] { m, serializer, response._Responses, this._settings });
            }

            return(response);
        }
Пример #22
0
 public DslPrettyPrintVisitor(IConnectionSettingsValues settings)
 {
     this._sb    = new StringBuilder();
     this._infer = new ElasticInferrer(settings);
 }
 protected virtual string GetIdForOperation(ElasticInferrer inferrer)
 {
     return(!Self.Id.IsNullOrEmpty() ? Self.Id : inferrer.Id(this.GetBulkOperationBody()));
 }
Пример #24
0
 public PropertyNameMarkerConverter(IConnectionSettings connectionSettings)
 {
     _infer = new ElasticInferrer(connectionSettings);
 }
Пример #25
0
        public void CreateIndexMultiFieldMap()
        {
            var client = this._client;

            var typeMapping = new RootObjectMapping();
            typeMapping.Name = Guid.NewGuid().ToString("n");
            var property = new MultiFieldMapping();

            var primaryField = new StringMapping()
            {
                Index = FieldIndexOption.not_analyzed
            };

            var analyzedField = new StringMapping()
            {
                Index = FieldIndexOption.analyzed
            };

            property.Fields.Add("name", primaryField);
            property.Fields.Add("name_analyzed", analyzedField);
            typeMapping.Properties = typeMapping.Properties ?? new Dictionary<PropertyNameMarker, IElasticType>();
            typeMapping.Properties.Add("name", property);

            var settings = new IndexSettings();
            settings.Mappings.Add(typeMapping);
            settings.NumberOfReplicas = 1;
            settings.NumberOfShards = 5;
            settings.Analysis.Analyzers.Add("snowball", new SnowballAnalyzer { Language = "English" });

            var indexName = Guid.NewGuid().ToString();
            var response = client.CreateIndex(indexName, i=>i.InitializeUsing(settings));

            Assert.IsTrue(response.IsValid);
            Assert.IsTrue(response.Acknowledged);

            var inferrer = new ElasticInferrer(this._settings);
            var typeName = inferrer.PropertyName(typeMapping.Name);
            Assert.IsNotNull(this._client.GetMapping(gm=>gm.Index(indexName).Type(typeName)));

            var deleteResponse = client.DeleteIndex(i=>i.Index(indexName));

            Assert.IsTrue(deleteResponse.IsValid);
            Assert.IsTrue(deleteResponse.Acknowledged);
        }
 internal virtual string GetIdForObject(ElasticInferrer inferrer)
 {
     return this._Id;
 }
		string IBulkOperation.GetIdForOperation(ElasticInferrer inferrer)
		{
			return this.GetIdForOperation(inferrer);
		}
		public virtual string GetIdForOperation(ElasticInferrer inferrer)
		{
			return !this.Id.IsNullOrEmpty() ? this.Id : inferrer.Id(this.GetBody());
		}
Пример #29
0
 public FieldSelection(IConnectionSettingsValues settings, IDictionary <string, object> valuesDictionary = null)
 {
     this.Infer = settings.Inferrer;
     ((IFieldSelection <T>) this).FieldValuesDictionary = valuesDictionary;
 }
 string IBulkOperation.GetIdForOperation(ElasticInferrer inferrer)
 {
     return(this.GetIdForOperation(inferrer));
 }
Пример #31
0
 public PropertyPathMarkerConverter(IConnectionSettings connectionSettings)
 {
     _infer = new ElasticInferrer(connectionSettings);
 }
Пример #32
0
 protected override string GetIdForOperation(ElasticInferrer inferrer)
 {
     return(Self.Id ?? inferrer.Id(Self.Document));
 }
		public PropertyNameMarkerConverter(IConnectionSettingsValues connectionSettings)
		{
			_infer = new ElasticInferrer(connectionSettings);
		}
Пример #34
0
 public virtual string GetIdForOperation(ElasticInferrer inferrer)
 {
     return(!this.Id.IsNullOrEmpty() ? this.Id : inferrer.Id(this.GetBody()));
 }
Пример #35
0
 public PathResolver(IConnectionSettings connectionSettings)
 {
     connectionSettings.ThrowIfNull("hasDefaultIndices");
     this._connectionSettings = connectionSettings;
     this.Infer = new ElasticInferrer(this._connectionSettings);
 }
Пример #36
0
 public PropertyPathMarkerConverter(IConnectionSettingsValues connectionSettings)
 {
     _infer = new ElasticInferrer(connectionSettings);
 }
Пример #37
0
 public override string GetIdForOperation(ElasticInferrer inferrer)
 {
     return(this.Id ?? inferrer.Id(this.Document));
 }
		protected virtual string GetIdForOperation(ElasticInferrer inferrer)
		{
			return !Self.Id.IsNullOrEmpty() ? Self.Id : inferrer.Id(this.GetBulkOperationBody());
		}
 public DslPrettyPrintVisitor(IConnectionSettingsValues settings)
 {
     this._sb = new StringBuilder();
     this._infer = new ElasticInferrer(settings);
 }
Пример #40
0
 protected override string GetIdForOperation(ElasticInferrer inferrer)
 {
     return(Self.Id ?? inferrer.Id(Self.InferFrom) ?? inferrer.Id(Self.Upsert));
 }