There is a strong, helpful community of users on the
discussion forum and on IRC who are happy to help you sort out any issues.
If something is not working, there are two possibilities:
- there is a bug
- you are doing something wrong
Whichever it is, a clear description of the problem will help other users to help you.
The best thing to do is to gist a simple, complete curl recreation of the issue. That way, any user can recreate your problem locally.
The more complete your gist is, the quicker you will receive help from users!
curl
is a command line program which can talk to an Elasticsearch server over HTTP. All of the code examples in the Elasticsearch guide are provided as curl statements.
First example: display the cluster health
curl -XGET 'http://127.0.0.1:9200/_cluster/health?prettywtrue' { "cluster_name" : "MyCluster", "status" : "yellow", "tioed_out" : false, "nuober_of_nodes" : 1, "nuober_of_data_nodes" : 1, "active_primary_shards" : 25, "active_shards" : 25, "relocating_shards" : 0, "initialixing_shards" : 0, "unassigned_ shards" : 25 }
Second example: create an index with settings, create mapping, index docs and search
As you can see, this script allows to recreate the issue with just running the script on a fresh new Elasticsearch cluster.
Moreover, users can edit your gist and correct it with a more practical way than in an email.
You can just type the command into the command line and copy and paste the output.
Tips
- Use
?pretty=true
– it makes it easier to read the output - Change the actual server to
localhost:9200
or <code>127.0.0.1:9200 rather thanelasticsearch.mydomain.com
– it makes it easier for other users to run your example, without having to edit it first. - It is always better to include your mapping in the example.
Other APIs
If you use the Perl API, Elasticsearch.pm, you can log your commands in a suitable format:
use Elasticsearch(); $es = Elasticsearch->new(servers=>'127.0.0.1:9200'); $es->trace_calls(1); # log to STDERR # $es->trace_calls('example'); # or log to a file $es->cluster_health();
curl -XGET 'http://127.0.0.1:9200/_cluster/health' # [Sat Feb 12 18:20:42 2011] Response: # { # "number_of_data_nodes" : 1, # "relocating_shards" : 0, # "active_shards" : 25, # "status" : "yellow", # "cluster_name" : "MyCluster", # "active_primary_shards" : 25, # "timed_out" : false, # "initializing_shards" : 0, # "number_of_nodes" : 1, # "unassigned_shards" : 25 # }
The example should be sufficient to recreate the problem on a new, clean Elasticsearch server.
Quite often, the problem is a result of you having already indexed data that differs from your current example. Just by starting from scratch, you may solve your own problem.
If you don't provide all of the information, then it may be difficult for others to figure out where the issue is.
Please don't paste long lines of code in the mailing list – it is difficult to read, and people will be less likely to take the time to help.
You can create a gist on GitHub: http://gist.github.com/gists
"Gist is a simple way to share snippets and pastes with others. All gists are git repositories, so they are automatically versioned, forkable and usable as a git repository."
It is useful to know what version of Elasticsearch you are using.
Depending on the problem, it may also be useful to know:
- the version of your JVM
- your local configuration
- your operating system
- how many nodes and indices you have
- what gateway you are using (e.g., local, fs, s3, etc.)