first_commit

This commit is contained in:
2023-02-19 10:04:10 +01:00
commit ed610970cb
23 changed files with 11434 additions and 0 deletions

18
test_search.py Normal file
View 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",[""]))
))