Esempio n. 1
0
def viz_endpoint(query):
    url = "http://localhost:9200/dossiers/_search"
    q = {"_source": ["entity"], "fields": ["entities", "title"], "query": {"term": {"file": query}}, "size": 100}
    # r=requests.post(url,data=json.dumps(q))
    r = es.search(body=q, index=DEFAULT_INDEX)
    data = r
    # graph = make_graph(data)
    graph = document_graph(data["hits"]["hits"])
    return json.dumps(graph)
Esempio n. 2
0
def viz_all():
    q = {"query": {"match_all": {}}}
    r = es.search(body=q,
                  index=es_index,
                  fields=["entities", "title"],
                  size=100)
    data = r['hits']['hits']
    graph = document_graph(data)

    return json.dumps(graph)
Esempio n. 3
0
def viz_all():
    q = {
        "fields" : ["entities","title"],
        "query" : {
            "match_all" : {}
            },
        "size": 100
        }
    r = es.search(body=q, index=DEFAULT_INDEX)
    graph = document_graph(r['hits']['hits'])

    return json.dumps(graph)
Esempio n. 4
0
def history_query():
    """ AND query over all active history terms """
    terms = active_history_terms(session["history"])
    body = {
        "_source": ["entity"],
        "fields": ["entities", "title"],
        "query": {"constant_score": {"filter": {"terms": {"file": terms, "execution": "and"}}}},
    }
    r = es.search(body=body, index=DEFAULT_INDEX, size=100)
    graph = make_response(json.dumps(document_graph(r["hits"]["hits"])))

    return graph
Esempio n. 5
0
def viz_all():
    q = {
        "query": {
            "match_all": {}
        }
    }
    r = es.search(body=q,
                  index=es_index,
                  fields=["entities", "title"],
                  size=100)
    data = r['hits']['hits']
    graph = document_graph(data)

    return json.dumps(graph)
Esempio n. 6
0
def viz_endpoint(query):
    # url = '{}/_search'.format(es_path)
    q = {
        "_source": ["entity"],
        "fields": ["entities", "title"],
        "query": {
            "match": {
                "file": query
            }
        },
        "size": 150
    }

    r = es.search(body=q, index=es_index)
    data = r['hits']['hits']
    graph = document_graph(data)
    return json.dumps(graph)
Esempio n. 7
0
def viz_endpoint(query):
    # url = '{}/_search'.format(es_path)
    q = {
        "_source": ["entity"],
        "fields": ["entities", "title"],
        "query": {
            "match": {
                "file": query
            }
        },
        "size": 150
    }

    r = es.search(body=q, index=es_index)
    data = r['hits']['hits']
    graph = document_graph(data)
    return json.dumps(graph)
Esempio n. 8
0
def history_query():
    """
    AND query over all active history terms
    """
    terms = active_history_terms(session['history'])
    body = {
        "_source": ["entity"],
        "fields": ["entities", "title"],
        "query": {
            "constant_score": {
                "filter": {
                    "terms": {
                        "file": terms,
                        "execution": "and"
                    }
                }
            }
        }
    }
    r = es.search(body=body, index=es_index, size=100)
    data = r['hits']['hits']
    graph = make_response(json.dumps(document_graph(data)))

    return graph
Esempio n. 9
0
def history_query():
    """
    AND query over all active history terms
    """
    terms = active_history_terms(session['history'])
    body = {
        "_source": ["entity"],
        "fields": ["entities", "title"],
        "query": {
            "constant_score": {
                "filter": {
                    "terms": {
                        "file": terms,
                        "execution": "and"
                    }
                }
            }
        }
    }
    r = es.search(body=body, index=es_index, size=100)
    data = r['hits']['hits']
    graph = make_response(json.dumps(document_graph(data)))

    return graph