def load_to_elastic(json_docs): """ :param json_docs: list of json docs :return: None """ # upload to elastic if len(json_docs) > 0: print(json_docs) elastic = Elastic(cloud_id=os.environ['ELASTIC_CLOUD_ID'], username=os.environ['ELASTIC_USERNAME'], password=os.environ['ELASTIC_PASSWORD']) elastic.clear_data("tweet-index") elastic.load_data(json_docs, "tweet-index")
import random import math import pandas as pd import matplotlib.pyplot as plt import argparse # clear data in elastic from elastic import Elastic # needs to be changed to from simulator.elastic import Elastic when run from project root dir Elastic.clear_data('covid_df') Elastic.clear_data('stats_df') Elastic.clear_data('eco_df') def point(x_limit, y_limit): """ Generate a random 2D point Keyword arguments: x_limit -- max range on X-axis y_limit -- max range on Y-axis """ assert isinstance(x_limit, int) assert isinstance(y_limit, int) x = random.uniform(0, x_limit) y = random.uniform(0, y_limit) return x, y