本文整理匯總了Python中elasticsearch_dsl.Integer方法的典型用法代碼示例。如果您正苦於以下問題:Python elasticsearch_dsl.Integer方法的具體用法?Python elasticsearch_dsl.Integer怎麽用?Python elasticsearch_dsl.Integer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類elasticsearch_dsl
的用法示例。
在下文中一共展示了elasticsearch_dsl.Integer方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _query
# 需要導入模塊: import elasticsearch_dsl [as 別名]
# 或者: from elasticsearch_dsl import Integer [as 別名]
def _query(self, quantity, o, value, nested=None):
field = self._field(quantity, nested=nested)
if o in _cmp_operators:
return Q("range", **{field: {_cmp_operators[o]: value}})
if quantity.elastic_mapping_type == Text:
query_type = "match"
elif quantity.elastic_mapping_type in [Keyword, Integer]:
query_type = "term"
else:
raise NotImplementedError("Quantity has unsupported ES field type")
if o in ["=", ""]:
return Q(query_type, **{field: value})
if o == "!=":
return ~Q(
query_type, **{field: value}
) # pylint: disable=invalid-unary-operand-type
raise Exception("Unknown operator %s" % o)
示例2: setup_collection
# 需要導入模塊: import elasticsearch_dsl [as 別名]
# 或者: from elasticsearch_dsl import Integer [as 別名]
def setup_collection(self):
class WebLink(DocType):
url = Text()
html = Text()
headers = Text()
status = Integer()
created = Date()
class Meta:
index = self.database_name
doc_type = self.collection_name
return WebLink
示例3: setup_collection
# 需要導入模塊: import elasticsearch_dsl [as 別名]
# 或者: from elasticsearch_dsl import Integer [as 別名]
def setup_collection(self):
class WebLinkExtracted(DocType):
url = Text()
body = Text()
headers = Text()
status = Integer()
created = Date()
class Meta:
index = self.database_name
doc_type = self.collection_name
return WebLinkExtracted
示例4: test_required_int_can_be_0
# 需要導入模塊: import elasticsearch_dsl [as 別名]
# 或者: from elasticsearch_dsl import Integer [as 別名]
def test_required_int_can_be_0():
class DT(Document):
i = Integer(required=True)
dt = DT(i=0)
assert dt.full_clean() is None
示例5: test_required_field_cannot_be_empty_list
# 需要導入模塊: import elasticsearch_dsl [as 別名]
# 或者: from elasticsearch_dsl import Integer [as 別名]
def test_required_field_cannot_be_empty_list():
class DT(Document):
i = Integer(required=True)
dt = DT(i=[])
with raises(ValidationException):
dt.full_clean()