Created
May 5, 2015 21:36
-
-
Save GERey/a1726e876fed1bdc1167 to your computer and use it in GitHub Desktop.
deleteIndexEdge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final Observable<IndexOperationMessage> batches = Observable.just( edge ).map( | |
observableEdge -> generateScopeFromSource( edge ) ).flatMap( indexEdge -> { | |
final ApplicationEntityIndex ei = entityIndexFactory.createApplicationEntityIndex( applicationScope ); | |
//TODO: make method to keep looping through elasticsearch until there are no more indexs to batchup | |
CandidateResults crs = ei.search( indexEdge, SearchTypes.fromTypes( edge.getType() ), "select *", 10, 0 ); | |
final EntityIndexBatch batch = ei.createBatch(); | |
logger.debug( "deleting edge {} to batch for scope {}", indexEdge, applicationScope ); | |
//TODO: extract this into its own function. | |
Iterator itr = crs.iterator(); | |
while( itr.hasNext() ) { | |
CandidateResult cr = ( CandidateResult ) itr.next(); | |
batch.deindex( indexEdge, cr.getId(), cr.getVersion() ); | |
} | |
return batch.execute(); | |
} ); | |
return ObservableTimer.time( batches, addTimer ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment