Failed to start shard

I have a project that uses ElasticSearch for searching and all the goodness that it has. When I test a new technology, I like to break it a few times.  Like adding a bunch of data, hitting the stop button on the service or killing the task in task manager.

So I did this with ElasticSearch, and I received this error message.

failed to recover shard]; nested: ElasticsearchIllegalArgumentException[No version type match

Everywhere that I read included some details about how the disk filled up, or was low on space.

Capture

 

Simple solution, flush the index. ElasticSearch has an internal and on disk transaction log.  Being used to SQL’s ACID based consistency, you can’t shutdown the service without ill-effects. 8-7-2014 10-58-01 AM

 

More details on the flush command and how to access it from the API versus the HEAD plugin, http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-flush.html

 

 

S.L.A.B. To ElasticSearch

I always like to find new ways to not write the same code twice. Logging has been one of those features that every application needs, and every application does it differently. Do you log to SQL, a text file, for how long, what format?

The Semantic Logging Application Block supports SQL, Azure, ElasticSearch or any other “Sink” you want to write. It supports buffering, retry for when a Sink isn’t available. Awesome, all the stuff I want but don’t need to write my own version of. More details on SLAB here, Semantic Logging Application Block @ CodePlex

So how do you use this wonderful tool?

1. Install ElasticSearch. It is more like an XCopy deploy then an MSI Install. Installing ElasticSearch @ ElasticSearch.org

2.  Install the template from ElasticSearch Sink to help ElasticSearch understand your log messages.

3.Download the Nuget Packages,

PM > Install-Package EnterpriseLibrary.SemanticLogging.Elasticsearch

4. Put this Gist into your code somewhere and point it to your ElasticSearch server. Make sure your log type matches the one used in the ElasticSearch Template. Best to just use “etw” as below.

[gist id=”7e367d7bf5fbcab5129c” synhi=true lang=”csharp”]

5. Log an error

[csharp]LoggingEvents.Log.Error(ex);
[/csharp]

6. Done.

Next post I will show how to use two different ElasticSearch plugins to monitor and view your errors.