Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # python code
- from django.conf import settings as s
- from elasticsearch import Elasticsearch
- import graphene
- from graphene_django import DjangoObjectType
- def elastic_connection():
- pk = 54
- es = Elasticsearch(hosts=s.ELASTIC)
- elastic_data = es.get_source(index=s.ELASTIC_INDEX, doc_type=s.ELASTIC_DOC_TYPE, id=pk)
- return elastic_data
- class ElasticType(graphene.ObjectType):
- id = graphene.ID()
- index = graphene.String()
- found = graphene.String()
- class Query(graphene.ObjectType):
- elastic = graphene.List(ElasticType)
- def resolve_elastic(self, info):
- return elastic_connection()
Add Comment
Please, Sign In to add comment