Commit 948e7eff authored by Maria  Di Girolamo's avatar Maria Di Girolamo
Browse files

test to solve conflict with merge

parent 7581b60c
Pipeline #16122 passed with stage
in 1 minute and 33 seconds
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
import requests
# import the elasticsearch client library
from elasticsearch import Elasticsearch
# import Python's json library to format JSON responses
import json, time
# use codecs to open the existing HTML file
import codecs
import traceback
import csv
from datetime import datetime
from elasticsearch import Elasticsearch
es = Elasticsearch()
# globals for the Elasticsearch domain
# ResourceWarning: unclosed <socket.socket> error if HTTP in domain
DOMAIN = "localhost"
# create a timestamp using the time() method
start_time = time.time()
# keep track of the number of the documents returned
doc_count = 0
#URL = "http://localhost:9200/knowledgebase/_search/?_source=projectName&pretty=true"
URL = "http://localhost:9200/knowbase/_search"
#URL = "http://localhost:9200/knowbase/_search/?_source=projectName,topic,label,programmingLanguage"
INDEX = "knowbase"
r =
#print("z = r.json()")
z = r.json()
i = 0
for k in z :
doc = {
'know': r.json(),
res = es.index(index=INDEX, id=i, body=doc)
res = es.get(index=INDEX, id=i)
i = i + 1
#print("knowledgebase refresh")
query_all = {'size':10000, 'query': {'match_all': {}}}
res ="knowbase", body=query_all)
#res =, body={"query": {"match_all": {}}})
for hit in res['hits']['hits']:
print("PROJECT NAME: ",hit["_source"]['projectName'])
#print(" - TOPIC: ",hit["_source"]['topic'], " - LABEL: ",hit["_source"]['label'])
print("Got %d Hits " % res['hits']['total']['value'])
print("the end")
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment