Skip to content

Instantly share code, notes, and snippets.

💭
😃 Set status

Russ Cam russcam

💭
😃 Set status
Block or report user

Report or block russcam

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@russcam
russcam / Cancellation-In-NEST-2.x.cs
Created Dec 28, 2016
Cancellation for async methods in NEST 2.x
View Cancellation-In-NEST-2.x.cs
void Main()
{
var client = new ElasticClient();
var cancellationTokenSource = new CancellationTokenSource();
client.Search<Document>(s => s
.Query(q => q
.MatchAll()
)
.RequestConfiguration(r => r
@russcam
russcam / Fields-with-NEST-5.0.1.cs
Created Jan 23, 2017
Working with Fields in NEST 5.0.1
View Fields-with-NEST-5.0.1.cs
void Main()
{
var pool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var connectionSettings = new ConnectionSettings(pool);
var client = new ElasticClient(connectionSettings);
/**
All the following produce the query json
View results.json
{
"took": 55,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 2,
View filter-path.cs
void Main()
{
var pool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var defaultIndex = "default-index";
var connectionSettings = new ConnectionSettings(pool)
.DefaultIndex(defaultIndex)
.PrettyJson()
.DisableDirectStreaming()
.OnRequestCompleted(response =>
{
@russcam
russcam / ElasticStack.ps1
Last active Jul 19, 2018
Download, unzip and run Elasticsearch, Logstash, Kibana 5.x-6.x on Windows
View ElasticStack.ps1
New-Module -Name ElasticStack -Scriptblock {
function WriteLog {
[CmdletBinding()]
Param
(
[Parameter(Position=0, Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNullOrEmpty()]
[Alias("M")]
[string]$Message
@russcam
russcam / completion-suggester.cs
Last active Jan 16, 2020
Using Completion Suggester with NEST
View completion-suggester.cs
void Main()
{
var indexName = "stackoverflow";
var node = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var settings = new ConnectionSettings(node)
.InferMappingFor<Question>(m => m
.IndexName(indexName)
)
.PrettyJson()
.DisableDirectStreaming()
View exact-matching-icecreams.cs
private static void Main()
{
var defaultIndex = "icecreams";
var settings = new ConnectionSettings(new Uri("http://localhost:9200"))
.DefaultIndex(defaultIndex)
.DisableDirectStreaming()
.PrettyJson()
.OnRequestCompleted(callDetails =>
{
View keybase.md

Keybase proof

I hereby claim:

  • I am russcam on github.
  • I am russcam (https://keybase.io/russcam) on keybase.
  • I have a public key ASA-7ffVHxpC0Qs_F5orNv3SREep4hhx8m5fAuWhsItNaAo

To claim this, I am signing this object:

@russcam
russcam / ElasticShell.ps1
Last active Oct 24, 2019
PowerShell module to provide a curl like experience interacting with Elasticsearch from PowerShell
View ElasticShell.ps1
New-Module -Name ElasticShell -Scriptblock {
<#
.Synopsis
Execute REST API requests against Elasticsearch
.Description
Execute REST API requests against Elasticsearch.
Provides a curl-like experience for interacting with Elasticsearch, but with \m/ PowerShell \m/
@russcam
russcam / Custom-probe-matching-conditions.md
Last active Jul 17, 2018
Azure Portal Custom Probe matching conditions
View Custom-probe-matching-conditions.md

When a custom probe is specified in an Azure Resource Manager template that includes custom matching status codes to consider the backend pool as healthy, the Custom probe matching checkbox in the portal remains unchecked; when checked, the status codes defined in the ARM template do not appear in the portal UI, although it does appear that Application Gateway is using the provided status codes.

Here's an example of the match condition for a probe in a template:

"match": {
    "statusCodes": ["200-399", "401"]
}
You can’t perform that action at this time.