예제 #1
0
    def keys(self, prefix=None):
        from activedata_etl import etl2path, key2etl
        path = jx.reverse(etl2path(key2etl(prefix)))

        if self.cluster.version.startswith(("5.", "6.")):
            stored_fields = "stored_fields"
        else:
            stored_fields = "fields"

        result = self.es.search({
            stored_fields: ["_id"],
            "query": {
                "bool": {
                    "query": {
                        "match_all": {}
                    },
                    "filter": {
                        "and": [{
                            "term": {
                                "etl" + (".source" * i) + ".id": v
                            }
                        } for i, v in enumerate(path)]
                    }
                }
            }
        })

        if result.hits.hits:
            return set(result.hits.hits._id)
        else:
            return set()
예제 #2
0
    def keys(self, prefix=None):
        path = jx.reverse(etl2path(key2etl(prefix)))

        result = self.es.search({
            "fields": ["_id"],
            "query": {
                "filtered": {
                    "query": {
                        "match_all": {}
                    },
                    "filter": {
                        "and": [{
                            "term": {
                                "etl" + (".source" * i) + ".id": v
                            }
                        } for i, v in enumerate(path)]
                    }
                }
            }
        })

        if result.hits.hits:
            return set(result.hits.hits._id)
        else:
            return set()
예제 #3
0
    def keys(self, prefix=None):
        path = jx.reverse(etl2path(key2etl(prefix)))

        result = self.es.search({
            "fields": ["_id"],
            "query": {
                "filtered": {
                    "query": {"match_all": {}},
                    "filter": {"and": [{"term": {"etl" + (".source" * i) + ".id": v}} for i, v in enumerate(path)]}
                }
            }
        })

        if result.hits.hits:
            return set(result.hits.hits._id)
        else:
            return set()
예제 #4
0
    def keys(self, prefix=None):
        path = jx.reverse(etl2path(key2etl(prefix)))

        if self.cluster.version.startswith(("5.", "6.")):
            stored_fields = "stored_fields"
        else:
            stored_fields = "fields"

        result = self.es.search({
            stored_fields: ["_id"],
            "query": {
                "bool": {
                    "query": {"match_all": {}},
                    "filter": {"and": [{"term": {"etl" + (".source" * i) + ".id": v}} for i, v in enumerate(path)]}
                }
            }
        })

        if result.hits.hits:
            return set(result.hits.hits._id)
        else:
            return set()