-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path05_run_index_populate.py
More file actions
39 lines (29 loc) · 914 Bytes
/
05_run_index_populate.py
File metadata and controls
39 lines (29 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'''
The purpose of this file is to populate the ElasticSearch index.
Make sure ElasticSearch is running.
'''
import time, re, sys, os, json
from collections import defaultdict
from elasticsearch import Elasticsearch
from caseolap._05_index_populate import *
'''
Parameters
'''
# Input
parsed_text = 'data/pubmed.json'#'../../../caseolap/data/pubmed.json' # Parsed publications
index_populate_config = json.load(open('./config/index_populate_config.json'))
# Output
logfile_path = './log/indexing_log.txt' # Reports progress on indexing
# Names of the index you want to create
index_name = 'pubmed_x'
type_name = 'pubmed_meta_x'
'''
Main Code
'''
if __name__ == '__main__':
# Open the log file
logfile = open(logfile_path, 'w')
# Populate the index
populate_index(parsed_text, logfile, index_name, type_name, index_populate_config)
# Close the log file
logfile.close()