Skip to content

Instantly share code, notes, and snippets.

@acampagna
Created January 30, 2013 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save acampagna/a16e5946b67c6d12b2b8 to your computer and use it in GitHub Desktop.
Save acampagna/a16e5946b67c6d12b2b8 to your computer and use it in GitHub Desktop.
val jsonBuilder = new MapJSONBuilder()
val indexerSettings = new IndexerSettings(
"cache.user_marker",
"id,map_id,map_name,marker_name,num_markers,num_likes,num_comments,lat,lon",
"",
"id",
"maps",
"marker",
jsonBuilder,
1000
)
val mappingFile: String = "json/map_mapping.json"
val indexFile: String = "json/map_index.json"
def index() {
val startTime = System.nanoTime()
println("Deleting Index")
IndexingUtils.deleteIndex(this.client, this.indexerSettings.indexName)
Thread.sleep(1000)
println("Creating Index")
IndexingUtils.createIndex(this.client, this.indexerSettings.indexName, this.indexFile)
Thread.sleep(2000)
println("Creating Mapping")
IndexingUtils.createMapping(this.client, this.indexerSettings.indexName, this.indexerSettings.indexType, this.mappingFile)
Thread.sleep(1000)
println("Indexing Maps")
val bulkIndexer = new BulkIndexer(this.client,this.indexerSettings)
bulkIndexer.process()
val totalTime = (System.nanoTime - startTime) / 1000000000
Thread.sleep(1000)
println("Total Indexing Time: " + totalTime + " seconds.")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment