Skip to content

Instantly share code, notes, and snippets.

@marcio-azevedo
Created November 21, 2016 22:41
Show Gist options
  • Save marcio-azevedo/8d212cb925b5e3bc70edbaa9acc0dc1d to your computer and use it in GitHub Desktop.
Save marcio-azevedo/8d212cb925b5e3bc70edbaa9acc0dc1d to your computer and use it in GitHub Desktop.
ElasticSearch example for C#
var client = new ElasticClient();
var searchResponse = client.Search<Tweet>(s => s
.Index("social-*")
.Query(q => q
.Match(m => m
.Field(f => f.Message)
.Query("myProduct")
)
)
.Aggregations(a => a
.Terms("top_10_states", t => t
.Field(f => f.State)
.Size(10)
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment