public BaseJsonTests()
 {
     this._settings = new ConnectionSettings(UnitTestDefaults.Uri, UnitTestDefaults.DefaultIndex)
         .ExposeRawResponse();
     this._connection = new InMemoryConnection(this._settings);
     this._client = new ElasticClient(this._settings, this._connection);
 }
 public ElasticClientFactory(
     IConnectionSettingsValues settings = null,
     IConnection connection = null,
     ITransport transport = null,
     INestSerializer serializer = null) {
     this.CreateClient(settings, connection, transport, serializer);
 }
			public LocalJsonNetSerializer(
				IConnectionSettingsValues settings,
				Action<JsonSerializerSettings, IConnectionSettingsValues> settingsOverride
			) : base(settings)
			{
				this._settingsOverride = settingsOverride;
			}
 private static ElasticClient ElasticClientForIndexingFiles(
     IConnectionSettingsValues connectionSettingsForIndexingFiles)
 {
     var elasticClientForIndexingFiles =
         new ElasticClient(connectionSettingsForIndexingFiles);
     return elasticClientForIndexingFiles;
 }
		public FixedPipelineFactory(IConnectionSettingsValues connectionSettings, IDateTimeProvider dateTimeProvider)
		{
			this.DateTimeProvider = dateTimeProvider;
			this.MemoryStreamFactory = new MemoryStreamFactory();

			this.Settings = connectionSettings;
			this.Pipeline = this.Create(this.Settings, this.DateTimeProvider, this.MemoryStreamFactory, new SearchRequestParameters());
		}
		public static string Resolve(this IndexName marker, IConnectionSettingsValues connectionSettings)
		{
			if (marker == null)
				return null;
			connectionSettings.ThrowIfNull(nameof(connectionSettings));

			if (marker.Type == null)
				return marker.Name;
			return new IndexNameResolver(connectionSettings).Resolve(marker.Type);
		}
		public static string Resolve(this IndexNameMarker marker, IConnectionSettingsValues connectionSettings)
		{
			if (marker == null)
				return null;
			connectionSettings.ThrowIfNull("connectionSettings");

			if (marker.Type == null)
				return marker.Name;
			return new IndexNameResolver(connectionSettings).GetIndexForType(marker.Type);
		}
			public LocalJsonNetSerializer(IConnectionSettingsValues settings) : base(settings)
			{
				OverwriteDefaultSerializers((s, cvs) =>
					{
						s.DateParseHandling = DateParseHandling.None;
						s.MaxDepth = 1;
						s.ContractResolver = new MyCustomResolver(this.Settings, null);
						s.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat;
					}
				);
			}
        /// <summary>
        /// internal constructor by TypeMappingWriter itself when it recurses, passes seenTypes as safeguard agains maxRecursion
        /// </summary>
        internal TypeMappingWriter(Type t, string typeName, IConnectionSettingsValues connectionSettings, int maxRecursion, ConcurrentDictionary<Type, int> seenTypes)
        {
            this._type = GetUnderlyingType(t);
            this._connectionSettings = connectionSettings;

            this.TypeName = typeName;
            this.MaxRecursion = maxRecursion;
            this.SeenTypes = seenTypes;

            this._elasticSerializer = new NestSerializer(this._connectionSettings);
            this.Infer = new ElasticInferrer(this._connectionSettings);
        }
        public TypeMappingWriter(Type t, TypeNameMarker typeName, IConnectionSettingsValues connectionSettings, int maxRecursion)
        {
            this._type = t;
            this._connectionSettings = connectionSettings;

            this.TypeName = typeName;
            this.MaxRecursion = maxRecursion;

            this.SeenTypes = new ConcurrentDictionary<Type, int>();
            this.SeenTypes.TryAdd(t, 0);

            this._elasticSerializer = new NestSerializer(this._connectionSettings);
            this.Infer = new ElasticInferrer(this._connectionSettings);
        }
		public static IElasticPropertyAttribute Property(MemberInfo info, IConnectionSettingsValues settings = null)
		{
			if (settings != null)
			{
				PropertyMapping propertyMapping = null;
				if (settings.PropertyMappings.TryGetValue(info, out propertyMapping))
					return new ElasticPropertyAttribute {Name = propertyMapping.Name, OptOut = propertyMapping.Ignore};
			}

			var attributes = info.GetCustomAttributes(typeof(IElasticPropertyAttribute), true);
			if (attributes != null && attributes.Any())
				return ((IElasticPropertyAttribute)attributes.First());

			var ignoreAttrutes = info.GetCustomAttributes(typeof(JsonIgnoreAttribute), true);
			if (ignoreAttrutes != null && ignoreAttrutes.Any())
				return new ElasticPropertyAttribute { OptOut = true };

			return null;
		}
			public CustomSerializer(IConnectionSettingsValues settings) : base(settings) { }
		public FieldExpressionVisitor(IConnectionSettingsValues settings)
		{
			_settings = settings;
		}
        ElasticsearchPathInfo <GetIndexSettingsRequestParameters> IPathInfo <GetIndexSettingsRequestParameters> .ToPathInfo(IConnectionSettingsValues settings)
        {
            var pathInfo = base.ToPathInfo(settings, this._QueryString);

            pathInfo.HttpMethod = PathInfoHttpMethod.GET;

            return(pathInfo);
        }
			public LocalJsonNetSerializer(IConnectionSettingsValues settings, Action<JsonSerializerSettings, IConnectionSettingsValues> s, JsonConverter converter)
				: base(settings, converter)
			{
				this.OverwriteDefaultSerializers(s);
			}
 public EmptyCollectionElasticContractResolver(IConnectionSettingsValues connectionSettings) : base(connectionSettings) {}
			public MyJsonNetSerializer(IConnectionSettingsValues settings) : base(settings) { }
			public MyCustomResolver(IConnectionSettingsValues connectionSettings, IList<Func<Type, JsonConverter>> contractConverters) : base(connectionSettings, contractConverters)
			{
			}
 public PreSerializationProccessor(IConnectionSettingsValues settings)
     : base(settings)
 {
 }
			public IElasticsearchSerializer Create(IConnectionSettingsValues settings) =>
				new LocalJsonNetSerializer(settings, this._settingsOverride);
 public DslPrettyPrintVisitor(IConnectionSettingsValues settings)
 {
     _sb    = new StringBuilder();
     _infer = settings.Inferrer;
 }
		public SettingsContractResolver(IContractResolver wrapped, IConnectionSettingsValues connectionSettings)
		{
			this.ConnectionSettings = connectionSettings;
			this.Infer = new ElasticInferrer(this.ConnectionSettings);
			this._wrapped = wrapped ?? new DefaultContractResolver();
		}
 public ElasticContractResolver(IConnectionSettingsValues connectionSettings)
     : base(true)
 {
     this.ConnectionSettings = connectionSettings;
     this.Infer = new ElasticInferrer(this.ConnectionSettings);
 }
			public TestableFieldResolver(IConnectionSettingsValues settings) : base(settings) { }
		public MemberInfoResolver(IConnectionSettingsValues settings, Expression expression) : base(settings)
		{
			var stack = new Stack<string>();
			var properties = new Stack<IElasticPropertyAttribute>();
			base.Visit(expression, stack, properties);
		}
		public PropertyNameResolver(IConnectionSettingsValues settings)
		{
			_settings = settings;
		}
			public IElasticsearchSerializer CreateStateful(IConnectionSettingsValues settings, JsonConverter converter) =>
				new LocalJsonNetSerializer(settings, this._settingsOverride, converter);
Beispiel #28
0
 public TestConnection(IConnectionSettingsValues settings)
     : base(settings)
 {
 }
		public FieldResolver(IConnectionSettingsValues settings)
		{
			settings.ThrowIfNull(nameof(settings));
			this._settings = settings;
		}
 public DslPrettyPrintVisitor(IConnectionSettingsValues settings)
 {
     this._sb = new StringBuilder();
     this._infer = new ElasticInferrer(settings);
 }
		public PropertyNameResolver(IConnectionSettingsValues settings)
		{
			if (settings == null)
				throw new ArgumentNullException("settings");
			_settings = settings;
		}
Beispiel #32
0
 public NestStringifier(IConnectionSettingsValues settings)
 {
     _settings = settings;
     this.Infer = new ElasticInferrer(settings);
 }
Beispiel #33
0
 void IVulcanModfiySerializerSettings.Modifier(JsonSerializerSettings jsonSerializerSettings, IConnectionSettingsValues connectionSettingsValues)
 {
     jsonSerializerSettings.StringEscapeHandling = StringEscapeHandling.EscapeHtml;
 }