當前位置: 首頁>>代碼示例>>Python>>正文


Python elasticsearch_dsl.Integer方法代碼示例

本文整理匯總了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) 
開發者ID:Materials-Consortia,項目名稱:optimade-python-tools,代碼行數:23,代碼來源:elasticsearch.py

示例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 
開發者ID:invanalabs,項目名稱:invana-bot,代碼行數:15,代碼來源:elasticsearch.py

示例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 
開發者ID:invanalabs,項目名稱:invana-bot,代碼行數:15,代碼來源:elasticsearch.py

示例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 
開發者ID:elastic,項目名稱:elasticsearch-dsl-py,代碼行數:8,代碼來源:test_validation.py

示例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() 
開發者ID:elastic,項目名稱:elasticsearch-dsl-py,代碼行數:9,代碼來源:test_validation.py


注:本文中的elasticsearch_dsl.Integer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。