Skip to content

Commit

Permalink
change ES index prefixes to Peerplays-specific
Browse files Browse the repository at this point in the history
  • Loading branch information
gladcow committed Dec 31, 2019
1 parent a7b8ebb commit c1ebe51
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions libraries/plugins/elasticsearch/elasticsearch_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class elasticsearch_plugin_impl
uint32_t _elasticsearch_bulk_sync = 100;
bool _elasticsearch_visitor = false;
std::string _elasticsearch_basic_auth = "";
std::string _elasticsearch_index_prefix = "bitshares-";
std::string _elasticsearch_index_prefix = "peerplays-";
bool _elasticsearch_operation_object = false;
uint32_t _elasticsearch_start_es_after_block = 0;
bool _elasticsearch_operation_string = true;
Expand Down Expand Up @@ -413,7 +413,7 @@ void elasticsearch_plugin::plugin_set_program_options(
("elasticsearch-basic-auth", boost::program_options::value<std::string>(),
"Pass basic auth to elasticsearch database('')")
("elasticsearch-index-prefix", boost::program_options::value<std::string>(),
"Add a prefix to the index(bitshares-)")
"Add a prefix to the index(peerplays-)")
("elasticsearch-operation-object", boost::program_options::value<bool>(),
"Save operation as object(false)")
("elasticsearch-start-es-after-block", boost::program_options::value<uint32_t>(),
Expand Down
4 changes: 2 additions & 2 deletions libraries/plugins/es_objects/es_objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class es_objects_plugin_impl
bool _es_objects_balances = true;
bool _es_objects_limit_orders = true;
bool _es_objects_asset_bitasset = true;
std::string _es_objects_index_prefix = "objects-";
std::string _es_objects_index_prefix = "ppobjects-";
uint32_t _es_objects_start_es_after_block = 0;
CURL *curl; // curl handler
vector <std::string> bulk;
Expand Down Expand Up @@ -308,7 +308,7 @@ void es_objects_plugin::plugin_set_program_options(
("es-objects-balances", boost::program_options::value<bool>(), "Store balances objects(true)")
("es-objects-limit-orders", boost::program_options::value<bool>(), "Store limit order objects(true)")
("es-objects-asset-bitasset", boost::program_options::value<bool>(), "Store feed data(true)")
("es-objects-index-prefix", boost::program_options::value<std::string>(), "Add a prefix to the index(objects-)")
("es-objects-index-prefix", boost::program_options::value<std::string>(), "Add a prefix to the index(ppobjects-)")
("es-objects-keep-only-current", boost::program_options::value<bool>(), "Keep only current state of the objects(true)")
("es-objects-start-es-after-block", boost::program_options::value<uint32_t>(), "Start doing ES job after block(0)")
;
Expand Down
14 changes: 7 additions & 7 deletions tests/elasticsearch/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE(elasticsearch_account_history) {
graphene::utilities::ES es;
es.curl = curl;
es.elasticsearch_url = "http://localhost:9200/";
es.index_prefix = "bitshares-";
es.index_prefix = "peerplays-";
//es.auth = "elastic:changeme";

// delete all first
Expand All @@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE(elasticsearch_account_history) {
fc::usleep(fc::milliseconds(1000));

// for later use
//int asset_create_op_id = operation::tag<asset_create_operation>::value;
//int asset_crobjeate_op_id = operation::tag<asset_create_operation>::value;
//int account_create_op_id = operation::tag<account_create_operation>::value;

string query = "{ \"query\" : { \"bool\" : { \"must\" : [{\"match_all\": {}}] } } }";
Expand Down Expand Up @@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE(elasticsearch_account_history) {

// check the visitor data
auto block_date = db.head_block_time();
std::string index_name = graphene::utilities::generateIndexName(block_date, "bitshares-");
std::string index_name = graphene::utilities::generateIndexName(block_date, "peerplays-");

es.endpoint = index_name + "/data/2.9.12"; // we know last op is a transfer of amount 300
res = graphene::utilities::getEndPoint(es);
Expand All @@ -138,7 +138,7 @@ BOOST_AUTO_TEST_CASE(elasticsearch_objects) {
graphene::utilities::ES es;
es.curl = curl;
es.elasticsearch_url = "http://localhost:9200/";
es.index_prefix = "objects-";
es.index_prefix = "ppobjects-";
//es.auth = "elastic:changeme";

// delete all first
Expand Down Expand Up @@ -193,10 +193,10 @@ BOOST_AUTO_TEST_CASE(elasticsearch_suite) {
graphene::utilities::ES es;
es.curl = curl;
es.elasticsearch_url = "http://localhost:9200/";
es.index_prefix = "bitshares-";
es.index_prefix = "peerplays-";
auto delete_account_history = graphene::utilities::deleteAll(es);
fc::usleep(fc::milliseconds(1000));
es.index_prefix = "objects-";
es.index_prefix = "ppobjects-";
auto delete_objects = graphene::utilities::deleteAll(es);
fc::usleep(fc::milliseconds(1000));

Expand All @@ -219,7 +219,7 @@ BOOST_AUTO_TEST_CASE(elasticsearch_history_api) {
graphene::utilities::ES es;
es.curl = curl;
es.elasticsearch_url = "http://localhost:9200/";
es.index_prefix = "bitshares-";
es.index_prefix = "peerplays-";

auto delete_account_history = graphene::utilities::deleteAll(es);

Expand Down

0 comments on commit c1ebe51

Please sign in to comment.