public void insertDiscovery ( List < IMetric > batch ) throws IOException { batchHistogram . update ( batch . size ( ) ) ; if ( batch . size ( ) == 0 ) { log . debug ( "ElasticIO: batch size for insertDiscovery is zero, so skip calling Elasticsearch ingest." ) ; return ; } Timer . Context ctx = writeTimer . time ( ) ; try { for ( Object obj : batch ) { if ( ! ( obj instanceof IMetric ) ) { classCastExceptionMeter . mark ( ) ; continue ; } } elasticsearchRestHelper . indexMetrics ( batch ) ; } finally { ctx . stop ( ) ; } }
REST call to index into ES