data_insertion
File: data_insertion.py.
Description
This file is used to insert data into Elasticsearch.
insert_dataframe(logger, index, df)
¶
Insert a pandas DataFrame into Elasticsearch.
Attributes:
Name | Type | Description |
---|---|---|
logger |
Logger
|
The logger object. |
index |
str
|
The name of the Elasticsearch index to insert into. |
df |
DataFrame
|
The DataFrame to insert. |
Returns:
Name | Type | Description |
---|---|---|
response |
tuple[int, int | list[dict[str, list]]]
|
The response from the Elasticsearch bulk insertion. |
Source code in src/CryptoFraudDetection/elasticsearch/data_insertion.py
insert_dict(logger, index, data_dict)
¶
Insert a list of dictionaries into Elasticsearch.
Attributes:
Name | Type | Description |
---|---|---|
logger |
Logger
|
The logger object. |
index |
str
|
The name of the Elasticsearch index to insert into. |
data_dict |
dict[str, list[str]]
|
The dictionary to insert. |
Returns:
Name | Type | Description |
---|---|---|
response |
tuple[int, int | list[dict[str, Any]]
|
The response from the Elasticsearch bulk insertion. |