Searching Elasticsearch

October 11, 2016

I wanted to return a list of entries from ElasticSearch, and I wanted to just return ones where the _type field was set to c.

http://host:9200/logstash-2016.10.05/_search?q=_type:c&pretty=true

This URL will filter to just the rows with a _type of c ...

Listing ElasticSearch indexes

October 11, 2016

To find out a top level list of indexes in an ElasticSearch database, use:

http://host:9200/_cat/indices?v

which returns something like

health status index               pri rep docs.count docs.deleted store.size pri.store.size 
yellow open   logstash-2016.10.06   5   1      18908            0        6mb            6mb 
yellow ...

Running Services from PowerShell

September 14, 2016

I wanted to obtain a list of the running services on my windows machine. This can be done from PowerShell with the command:

Get-Service | Where-Object {$_.status -eq "running"}

Discover Powershell Version

September 14, 2016

How do you find out what version of Powershell you are running?

Start Powershell and then type:

$PSVersionTable.PSVersion

at the prompt:

PS H:\> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      -1     -1

Swagger and Enums in C#

September 8, 2016

By default, if you expose a service that has an Enum as a parameter, Swashbuckle will expose it using the index numbers of the enum in a dropdown. So in my case, given:

public enum TimeBasis { REALTIME, SLOW, FAST }

I got a droplist with 0, 1 and 2 in it ...