本文整理汇总了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()