internal virtual ElasticsearchPathInfo <K> ToPathInfo <K>(IConnectionSettings settings, K queryString) where K : FluentQueryString <K>, new() { var inferrer = new ElasticInferrer(settings); if (this._Index == null) { this._Index = inferrer.IndexName <T>(); } if (this._Type == null) { this._Type = inferrer.TypeName <T>(); } var index = new ElasticInferrer(settings).IndexName(this._Index); var type = new ElasticInferrer(settings).TypeName(this._Type); var pathInfo = new ElasticsearchPathInfo <K>() { Index = index, Type = type }; pathInfo.QueryString = queryString ?? new K(); return(pathInfo); }
internal virtual ElasticsearchPathInfo <K> ToPathInfo <K>(IConnectionSettings settings, K queryString) where K : FluentQueryString <K>, new() { var inferrer = new ElasticInferrer(settings); if (this._Type == null) { this._Type = inferrer.TypeName <T>(); } var index = !this._Indices.HasAny() ? inferrer.IndexName <T>() : string.Join(",", this._Indices.Select(inferrer.IndexName)); if (this._AllIndices.GetValueOrDefault(false)) { index = "_all"; } var type = new ElasticInferrer(settings).TypeName(this._Type); var pathInfo = new ElasticsearchPathInfo <K>() { Index = index, Type = type }; pathInfo.QueryString = queryString ?? new K(); return(pathInfo); }
internal virtual ElasticsearchPathInfo <K> ToPathInfo <K>(IConnectionSettingsValues settings, K queryString) where K : FluentRequestParameters <K>, new() { var inferrer = new ElasticInferrer(settings); if (this._Index == null) { this._Index = inferrer.IndexName <T>(); } if (this._Type == null) { this._Type = inferrer.TypeName <T>(); } var index = new ElasticInferrer(settings).IndexName(this._Index); var type = new ElasticInferrer(settings).TypeName(this._Type); var pathInfo = new ElasticsearchPathInfo <K>() { Index = index, Type = type }; pathInfo.RequestParameters = queryString ?? new K(); pathInfo.RequestParameters.RequestConfiguration(r => this._RequestConfiguration); return(pathInfo); }
internal virtual ElasticsearchPathInfo <TParameters> ToPathInfo(IConnectionSettingsValues settings, TParameters queryString) { var inferrer = new ElasticInferrer(settings); if (this._Type == null) { this._Type = inferrer.TypeName <T>(); } var index = !this._Indices.HasAny() ? inferrer.IndexName <T>() : string.Join(",", this._Indices.Select(inferrer.IndexName)); if (this._AllIndices.GetValueOrDefault(false)) { index = "_all"; } var type = new ElasticInferrer(settings).TypeName(this._Type); var pathInfo = base.ToPathInfo(queryString); pathInfo.Index = index; pathInfo.Type = type; return(pathInfo); }
public ObjectMappingDescriptor(IConnectionSettings connectionSettings) { this._TypeName = new TypeNameResolver().GetTypeNameFor <TChild>(); this._Mapping = new ObjectMapping() { }; this._connectionSettings = connectionSettings; }
/// <summary> /// The type to execute the search on. Defaults to the inferred typename of T /// unless T is dynamic then a type (or AllTypes()) MUST be specified. /// </summary> public TDescriptor Type(TypeNameMarker type) { if (type == null) { return((TDescriptor)this); } return(this.Types(type)); }
public NestedObjectMappingDescriptor(IConnectionSettings connectionSettings) { this._connectionSettings = connectionSettings; this._TypeName = TypeNameMarker.Create <TChild>(); this._Mapping = new NestedObjectMapping() { }; }
public P FixedPath <T>(bool fixateType = false) { this._Index = typeof(T); if (fixateType) { this._Type = typeof(T); } return((P)this); }
public TDescriptor FixedPath <TAlternative>(bool fixateType = false) { this._Index = typeof(TAlternative); if (fixateType) { this._Type = typeof(TAlternative); } return((TDescriptor)this); }
public RootObjectMappingDescriptor(IConnectionSettings connectionSettings) { this._connectionSettings = connectionSettings; this._TypeName = TypeNameMarker.Create <T>(); this._Mapping = new RootObjectMapping() { TypeNameMarker = this._TypeName }; }
internal SearchDescriptor <T> Type(TypeNameMarker type) { if (type == null) { return(this); } this._Types = new[] { type }; return(this); }
public NestedObjectMappingDescriptor(IConnectionSettingsValues connectionSettings) { this._connectionSettings = connectionSettings; this._TypeName = TypeNameMarker.Create <TChild>(); this._Mapping = new NestedObjectMapping() { }; this.Infer = new ElasticInferrer(this._connectionSettings); }
public MultiSearchResponse MultiSearch(MultiSearchDescriptor multiSearchDescriptor) { multiSearchDescriptor.ThrowIfNull("multiSearchDescriptor"); var sb = new StringBuilder(); foreach (var operation in multiSearchDescriptor._Operations.Values) { var indeces = operation._Indices.HasAny() ? string.Join(",", operation._Indices) : null; if (operation._AllIndices) { indeces = "_all"; } var index = indeces ?? multiSearchDescriptor._FixedIndex ?? new IndexNameResolver(this._connectionSettings).GetIndexForType(operation._ClrType); var types = operation._Types.HasAny() ? string.Join(",", operation._Types.Select(x => x.Resolve(this._connectionSettings))) : null; var typeName = types ?? multiSearchDescriptor._FixedType ?? TypeNameMarker.Create(operation._ClrType); if (operation._AllTypes) { typeName = null; //force empty typename so we'll query all types. } var op = new { index = index, type = typeName, search_type = this.GetSearchType(operation), preference = operation._Preference, routing = operation._Routing }; var opJson = this.Serializer.Serialize(op, Formatting.None); var action = "{0}\n".F(opJson); sb.Append(action); var searchJson = this.Serializer.Serialize(operation, Formatting.None); sb.Append(searchJson + "\n"); } var json = sb.ToString(); var path = "_msearch"; if (!multiSearchDescriptor._FixedIndex.IsNullOrEmpty()) { if (!multiSearchDescriptor._FixedType.IsNullOrEmpty()) { path = multiSearchDescriptor._FixedType + "/" + path; } path = multiSearchDescriptor._FixedIndex + "/" + path; } var status = this.Connection.PostSync(path, json); var multiSearchConverter = new MultiSearchConverter(this._connectionSettings, multiSearchDescriptor); var multiSearchResponse = this.Deserialize <MultiSearchResponse>(status, extraConverters: new List <JsonConverter> { multiSearchConverter }); return(multiSearchResponse); }
public TemplateMappingDescriptor RemoveMapping <T>() where T : class { var typeName = new TypeNameMarker { Type = typeof(T) }.Resolve(this._connectionSettings); this._TemplateMapping.Mappings.Remove(typeName); return(this); }
public PutMappingDescriptor <T> SetParent <K>() where K : class { var parentType = TypeNameMarker.Create <K>(); this._Mapping.Parent = new ParentTypeMapping() { Type = parentType }; return(this); }
public DeleteByQueryRequest(IndexNameMarker index, TypeNameMarker type = null) { this.Indices = new [] { index }; if (type != null) { this.Types = new[] { type } } ; else { this.AllTypes = true; } }
protected QueryPathBase(IndexNameMarker index, TypeNameMarker type = null) { this.Indices = new [] { index }; if (type != null) { this.Types = new[] { type } } ; else { this.AllTypes = true; } }
internal virtual ElasticsearchPathInfo <TParameter> ToPathInfo(IConnectionSettingsValues settings, TParameter queryString) { var inferrer = new ElasticInferrer(settings); if (this._Index == null) { this._Index = inferrer.IndexName <T>(); } if (this._Type == null) { this._Type = inferrer.TypeName <T>(); } var index = inferrer.IndexName(this._Index); var type = inferrer.TypeName(this._Type); var pathInfo = base.ToPathInfo(queryString); pathInfo.Index = index; pathInfo.Type = type; return(pathInfo); }
internal static bool IsNullOrEmpty(this TypeNameMarker value) { return(value == null || value.GetHashCode() == 0); }
public TDescriptor Type <TAlternative>() where TAlternative : class { this._Type = typeof(TAlternative); return((TDescriptor)this); }
private string ResolveTypeName(TypeNameMarker typeNameMarker, string defaultIndexName = null) { return(typeNameMarker != null?typeNameMarker.Resolve(this._connectionSettings) : defaultIndexName); }
public TopChildrenQueryDescriptor() { this._Type = TypeNameMarker.Create <T>(); }
public string TypeName(TypeNameMarker type) { return(type == null ? null : this.TypeNameResolver.GetTypeNameFor(type)); }
public GenericJsonOpenSearchable(IndexNameMarker index, TypeNameMarker type) { this.type = type; this.index = index; }
public SourceRequest(IndexNameMarker indexName, TypeNameMarker typeName, string id) : base(indexName, typeName, id) { }
public TDescriptor Type(Type type) { this._Type = type; return((TDescriptor)this); }
public TypeExistsRequest(IndexNameMarker index, TypeNameMarker typeNameMarker) : base(index, typeNameMarker) { }
protected SearchExistsRequest(IndexNameMarker index, TypeNameMarker type = null) : base(index, type) { }
public HasChildQueryDescriptor() { this._Type = TypeNameMarker.Create <T>(); }
public IndicesExistsTypeRequest(IndexNameMarker index, TypeNameMarker typeNameMarker) : base(index, typeNameMarker) { }
public string TypeName(Type t) { return(TypeNameMarker.Create(t).Resolve(this._connectionSettings)); }