Esempio n. 1
0
        private string CreateUpdatePath <T>(UpdateDescriptor <T> s) where T : class
        {
            var index = s._Index ?? this.Settings.GetIndexForType <T>();
            var type  = s._Type ?? ElasticClient.GetTypeNameFor <T>();
            var id    = s._Id ?? this.GetIdFor(s._Object);

            index.ThrowIfNullOrEmpty("index");
            type.ThrowIfNullOrEmpty("type");
            id.ThrowIfNullOrEmpty("id");

            var path = this.CreatePath(index, type, id) + "/_update?";

            if (s._Consistency.HasValue)
            {
                path += "consistency=" + Enum.GetName(typeof(Consistency), s._Consistency.Value);
            }
            if (s._Replication.HasValue)
            {
                path += "replication=" + Enum.GetName(typeof(Replication), s._Replication.Value);
            }
            if (s._Refresh.HasValue)
            {
                path += "refresh=" + s._Refresh.Value.ToString().ToLower();
            }

            if (s._Timeout.HasValue)
            {
                path += "timeout=" + s._Timeout.ToString();
            }
            if (s._Timeout.HasValue)
            {
                path += "timeout=" + s._Timeout.ToString();
            }

            if (!string.IsNullOrWhiteSpace(s._Percolate))
            {
                path += "percolate=" + s._Percolate;
            }

            if (!string.IsNullOrWhiteSpace(s._Parent))
            {
                path += "parent=" + s._Parent;
            }

            if (!string.IsNullOrWhiteSpace(s._Routing))
            {
                path += "routing=" + s._Routing;
            }

            return(path);
        }
Esempio n. 2
0
 public HasChildQueryDescriptor()
 {
     this._Type = ElasticClient.GetTypeNameFor <T>();
 }
Esempio n. 3
0
 /// <summary>
 /// The types 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 SearchDescriptor <T> Types(IEnumerable <Type> types)
 {
     types.ThrowIfEmpty("types");
     return(this.Types((IEnumerable <string>)types.Select(t => ElasticClient.GetTypeNameFor(t)).ToArray()));
 }
Esempio n. 4
0
 /// <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 SearchDescriptor <T> Type(Type type)
 {
     type.ThrowIfNull("type");
     return(this.Type(ElasticClient.GetTypeNameFor(type)));
 }
Esempio n. 5
0
 public TopChildrenQueryDescriptor()
 {
     this._Type = ElasticClient.GetTypeNameFor <T>();
 }