I hereby claim:
- I am beiske on github.
- I am beiske (https://keybase.io/beiske) on keybase.
- I have a public key whose fingerprint is 83B2 8FD5 4EBF CF81 0FEE FD61 E364 95E0 28B6 36DF
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| import java.nio.file.Files | |
| import scala.concurrent.duration._ | |
| import java.nio.file.Paths | |
| import scala.collection.JavaConverters._ | |
| import scala.concurrent.ExecutionContext | |
| import org.elasticsearch.client.transport.TransportClient | |
| import org.elasticsearch.common.settings.ImmutableSettings | |
| import org.elasticsearch.common.transport.InetSocketTransportAddress | |
| import com.sksamuel.elastic4s.ElasticClient | |
| import com.sksamuel.elastic4s.ElasticDsl._ |
| import java.nio.file.Files | |
| import java.nio.file.Paths | |
| import scala.Array.canBuildFrom | |
| import scala.collection.JavaConverters.iterableAsScalaIterableConverter | |
| import scala.concurrent.ExecutionContext.Implicits.global | |
| import org.elasticsearch.client.transport.TransportClient | |
| import org.elasticsearch.common.settings.ImmutableSettings | |
| import org.elasticsearch.common.transport.InetSocketTransportAddress |
| analyzer: | |
| nameAnalyzer: | |
| filter: | |
| - lowercase | |
| type: custom | |
| tokenizer: keyword | |
| analyzer: | |
| nameAnalyzer: | |
| filter: | |
| - lowercase | |
| type: custom | |
| tokenizer: keyword | |
| import os | |
| import json | |
| import base64 | |
| from elasticsearch.connection.thrift import * | |
| from elasticsearch import Elasticsearch | |
| from elasticsearch.connection import thrift | |
| from elasticsearch.connection.esthrift import Rest |
Create a standard mvn folder structure by putting each file in a folder like this:
├── pom.xml
└── src
└── test
├── java
│ └── UnknownHostExceptionTest.java
└── resources
└── trace.btm
| import scala.Option.option2Iterable | |
| import scala.concurrent.ExecutionContext.Implicits.global | |
| import scala.concurrent.Future | |
| import org.elasticsearch.action.search.SearchResponse | |
| import org.elasticsearch.client.transport.TransportClient | |
| import org.elasticsearch.common.settings.ImmutableSettings | |
| import org.elasticsearch.common.transport.InetSocketTransportAddress | |
| import com.sksamuel.elastic4s.ElasticClient | |
| import com.sksamuel.elastic4s.ElasticDsl._ | |
| import scala.concurrent.ExecutionContext |
| import scala.collection.immutable.Stream.consWrapper | |
| import scala.concurrent.Await | |
| import scala.concurrent.ExecutionContext.Implicits.global | |
| import scala.concurrent.Future | |
| import scala.concurrent.duration.Duration | |
| import scala.util.Failure | |
| import scala.util.Success | |
| import org.elasticsearch.action.search.SearchResponse | |
| import org.elasticsearch.client.transport.TransportClient |
| def prefetch[A](slowSource: Stream[A]): Stream[A] = { | |
| def fetch(stream: => Stream[A]) = { | |
| Future { | |
| stream(1) | |
| } | |
| } | |
| def cons(head: Future[A], tail: => Stream[A]): Stream[A] = { | |
| val next = fetch(tail) | |
| Await.result(head, Duration.Inf) #:: cons(next, tail.tail) | |
| } |