first_commit
This commit is contained in:
18
test_search.py
Normal file
18
test_search.py
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
import os
|
||||
from elasticsearch import Elasticsearch, helpers
|
||||
from searching import es_search, es_client
|
||||
ELASTIC_QUERY = os.environ.get("ELASTIC_QUERY","Anwesend")
|
||||
|
||||
#for hit in resp["hits"]["hits"]:
|
||||
# print(hit)
|
||||
|
||||
if __name__ =="__main__":
|
||||
resp = es_search(ELASTIC_QUERY)
|
||||
for hit in resp["hits"]["hits"]:
|
||||
print(f"\n\n%s\n%s\n%s - %s" % (
|
||||
hit.get("_source",{}).get("url",""),
|
||||
hit.get("_source",{}).get("title",""),
|
||||
" ".join(hit.get("highlight",{}).get("title",[""])),
|
||||
" ".join(hit.get("highlight",{}).get("text",[""]))
|
||||
))
|
||||
Reference in New Issue
Block a user