コード例 #1
0
    def obj_get_list(self, bundle, domain, **kwargs):
        include_archived = 'include_archived' in bundle.request.GET
        try:
            es_query = es_search(bundle.request, domain, ['include_archived'])
        except Http400 as e:
            raise BadRequest(e.message)
        if include_archived:
            es_query['filter']['and'].append({
                'or': [
                    {
                        'term': {
                            'doc_type': 'xforminstance'
                        }
                    },
                    {
                        'term': {
                            'doc_type': 'xformarchived'
                        }
                    },
                ]
            })
        else:
            es_query['filter']['and'].append(
                {'term': {
                    'doc_type': 'xforminstance'
                }})

        # Note that XFormES is used only as an ES client, for `run_query` against the proper index
        return ElasticAPIQuerySet(
            payload=es_query,
            model=ESXFormInstance,
            es_client=self.xform_es(domain)).order_by('-received_on')
コード例 #2
0
ファイル: v0_4.py プロジェクト: nikhilvarma22/commcare-hq
    def obj_get_list(self, bundle, domain, **kwargs):
        es_query = es_search(bundle.request, domain)    
        es_query['filter']['and'].append({'term': {'doc_type': 'xforminstance'}})

        return ESQuerySet(payload = es_query,
                          model = XFormInstance, 
                          es_client=self.xform_es(domain)) # Not that XFormES is used only as an ES client, for `run_query` against the proper index
コード例 #3
0
ファイル: v0_4.py プロジェクト: saakaifoundry/commcare-hq
    def obj_get_list(self, bundle, domain, **kwargs):
        include_archived = 'include_archived' in bundle.request.GET
        try:
            es_query = es_search(bundle.request, domain, ['include_archived'])
        except Http400 as e:
            raise BadRequest(e.message)
        if include_archived:
            es_query['filter']['and'].append({'or': [
                {'term': {'doc_type': 'xforminstance'}},
                {'term': {'doc_type': 'xformarchived'}},
            ]})
        else:
            es_query['filter']['and'].append({'term': {'doc_type': 'xforminstance'}})

        def wrapper(doc):
            if doc['doc_type'] in xform_doc_types:
                return xform_doc_types[doc['doc_type']].wrap(doc)
            else:
                return doc

        # Note that XFormES is used only as an ES client, for `run_query` against the proper index
        return ElasticAPIQuerySet(
            payload=es_query,
            model=wrapper,
            es_client=self.xform_es(domain)
        ).order_by('-received_on')
コード例 #4
0
ファイル: v0_4.py プロジェクト: kkrampa/commcare-hq
    def obj_get_list(self, bundle, domain, **kwargs):
        es_query = es_search(bundle.request, domain)
        es_query["filter"]["and"].append({"term": {"doc_type": "xforminstance"}})

        # Note that XFormES is used only as an ES client, for `run_query` against the proper index
        return ESQuerySet(payload=es_query, model=XFormInstance, es_client=self.xform_es(domain)).order_by(
            "-received_on"
        )
コード例 #5
0
ファイル: v0_3.py プロジェクト: twymer/commcare-hq
    def obj_get_list(self, bundle, domain, **kwargs):
        try:
            es_query = es_search(bundle.request, domain)
        except Http400 as e:
            raise BadRequest(str(e))

        return ElasticAPIQuerySet(
            payload=es_query, model=ESCase,
            es_client=self.case_es(domain)).order_by('server_modified_on')
コード例 #6
0
ファイル: v0_4.py プロジェクト: jmaina/commcare-hq
    def obj_get_list(self, bundle, domain, **kwargs):
        try:
            es_query = es_search(bundle.request, domain)
        except Http400 as e:
            raise BadRequest(e.message)
        es_query['filter']['and'].append({'term': {'doc_type': 'xforminstance'}})

        # Note that XFormES is used only as an ES client, for `run_query` against the proper index
        return ESQuerySet(payload = es_query,
                          model = XFormInstance,
                          es_client=self.xform_es(domain)).order_by('-received_on')
コード例 #7
0
ファイル: v0_4.py プロジェクト: thedevelopermw/commcare-hq
    def obj_get_list(self, bundle, domain, **kwargs):
        try:
            es_query = es_search(bundle.request, domain)
        except Http400 as e:
            raise BadRequest(e.message)
        es_query['filter']['and'].append({'term': {'doc_type': 'xforminstance'}})

        # Note that XFormES is used only as an ES client, for `run_query` against the proper index
        return ESQuerySet(payload = es_query,
                          model = XFormInstance,
                          es_client=self.xform_es(domain)).order_by('-received_on')
コード例 #8
0
    def obj_get_list(self, bundle, domain, **kwargs):
        es_query = es_search(bundle.request, domain)
        es_query['filter']['and'].append(
            {'term': {
                'doc_type': 'xforminstance'
            }})

        return ESQuerySet(
            payload=es_query,
            model=XFormInstance,
            es_client=self.xform_es(domain)
        )  # Not that XFormES is used only as an ES client, for `run_query` against the proper index
コード例 #9
0
ファイル: v0_4.py プロジェクト: puttarajubr/commcare-hq
    def obj_get_list(self, bundle, domain, **kwargs):
        include_archived = "include_archived" in bundle.request.GET
        try:
            es_query = es_search(bundle.request, domain, ["include_archived"])
        except Http400 as e:
            raise BadRequest(e.message)
        if include_archived:
            es_query["filter"]["and"].append(
                {"or": [{"term": {"doc_type": "xforminstance"}}, {"term": {"doc_type": "xformarchived"}}]}
            )
        else:
            es_query["filter"]["and"].append({"term": {"doc_type": "xforminstance"}})

        def wrapper(doc):
            if doc["doc_type"] in xform_doc_types:
                return xform_doc_types[doc["doc_type"]].wrap(doc)
            else:
                return doc

        # Note that XFormES is used only as an ES client, for `run_query` against the proper index
        return ESQuerySet(payload=es_query, model=wrapper, es_client=self.xform_es(domain)).order_by("-received_on")
コード例 #10
0
ファイル: v0_4.py プロジェクト: tsinkala/core-hq
 def obj_get_list(self, request, domain, **kwargs):
     return ESQuerySet(payload = es_search(request, domain),
                       model = XFormInstance, 
                       es_client=XFormES(domain)) # Not that XFormES is used only as an ES client, for `run_query` against the proper index