def as_dict(self): if self._filter and self._query: self._struct['query'] = Query.filtered( filter=self._filter, query=self._query ) elif self._filter: self._struct['query'] = Query.filtered( filter=self._filter ) elif self._query: self._struct['query'] = self._query if self._aggs: aggs = {} for agg in self._aggs: aggs.update(agg.as_dict()) self._struct['aggregations'] = aggs if self._suggesters: suggs = {} for sugg in self._suggesters: suggs.update(sugg.as_dict()) self._struct['suggest'] = suggs return unroll_struct(self._struct)
def as_dict(self): if self._filter and self._query: self._struct['query'] = Query.filtered(filter=self._filter, query=self._query) elif self._filter: self._struct['query'] = Query.filtered(filter=self._filter) elif self._query: self._struct['query'] = self._query if self._aggs: aggs = {} for agg in self._aggs: aggs.update(agg.as_dict()) self._struct['aggregations'] = aggs if self._suggesters: suggs = {} for sugg in self._suggesters: suggs.update(sugg.as_dict()) self._struct['suggest'] = suggs return unroll_struct(self._struct)
def as_dict(self): # Handle reserved Python keyword alternatives (from_, or_) dsl_type = ( self._dsl_type[:-1] if self._dsl_type.endswith('_') else self._dsl_type ) return {dsl_type: unroll_struct(self._struct)}
def as_dict(self): struct = {self._name: {self._dsl_type: unroll_struct(self._struct)}} if self._aggs: aggregates = {} for agg in self._aggs: aggregates.update(agg.as_dict()) struct[self._name]['aggregations'] = aggregates return struct
def as_dict(self): struct = { self._name: { "text": self._text, self._dsl_type: unroll_struct(self._struct) } } if self._suggs: for sugg in self._suggs: struct.update(sugg.as_dict()) return struct
def as_dict(self): struct = { self._name: { self._dsl_type: unroll_struct(self._struct) } } if self._aggs: aggregates = {} for agg in self._aggs: aggregates.update(agg.as_dict()) struct[self._name]['aggregations'] = aggregates return struct
def as_dict(self): # Handle reserved Python keyword alternatives (from_, or_) dsl_type = (self._dsl_type[:-1] if self._dsl_type.endswith('_') else self._dsl_type) return {dsl_type: unroll_struct(self._struct)}