Created
March 9, 2018 00:34
-
-
Save QiMata/0514f72017622b4654ab551a20b2013a to your computer and use it in GitHub Desktop.
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
[FunctionName("StreamOutputToElastic")] | |
public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequestMessage req, TraceWriter log) | |
{ | |
var node = new Uri("http://{username}:{password}@{ipaddress}:9200"); | |
var settings = new ConnectionSettings(node); | |
settings.DefaultIndex("my-index"); | |
var elasticClient = new ElasticClient(settings); | |
var records = await req.Content.ReadAsAsync<T>(); | |
await elasticClient.IndexManyAsync(timeStampedEvents, "my-index-name"); | |
return req.CreateResponse(HttpStatusCode.OK); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment