Last active
April 19, 2019 00:00
-
-
Save kylegallatin/c36fb641807e35e9b6bb8ad539415748 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from elasticsearch import Elasticsearch | |
from elasticsearch.helpers import bulk | |
es = Elasticsearch(['localhost:9200']) | |
docs = pdf2txt(pdf_path) | |
index = "mueller-report" | |
##good practice to delete an index if it already exists and you're overwriting | |
if es.indices.exists(index): | |
es.indices.delete(index) | |
## elastic helper function to bulk index json | |
bulk(es, docs, index=index, doc_type='clue', raise_on_error=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment