Example #1
0
    def __init__(self, local=True):
        if not self._es_index: 
            raise ESControllerError("Index not defined")

        self._host = str(ec2.getESip()) + ':9200'
        if local:
            self._es = Elasticsearch()
        else:
            self._es = Elasticsearch(self._host)
Example #2
0
    def __init__(self):
        if not self._es_index: 
            raise ESControllerError("Index not defined")

        self._host = str(ec2.getESip()) + ':9200'
        self._es = Elasticsearch(self._host)
Example #3
0
import getdoc as docdata
import re
import pprint
import sys
sys.path.append('/home/ec2-user/bblio/build/')
sys.path.append('/home/ec2-user/bblio/aws/')
import ec2
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'Build.settings'
from django.forms.models import model_to_dict
import time
import subprocess
from django.db import connection
from search.models import Document

host = str(ec2.getESip()) + ':9200'
print(host)
def query():
    es = Elasticsearch(host)

    q = {
            "query" : {
                "match_all" : {  }
                },
            "facets" : {
                "text" : {
                    "terms" : {
                        "field" : "text",
                        "size" : 1
                        }
                    }