Skip to content

Instantly share code, notes, and snippets.

@Grokling
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Grokling/b37a145c73156199cec1 to your computer and use it in GitHub Desktop.
Save Grokling/b37a145c73156199cec1 to your computer and use it in GitHub Desktop.
ES docker restart issue
Freshly built index, logstash couchdb_changes populates index from couchdb (242 docs loaded):
$ curl http://localhost:9200/hx/logs/_search?pretty=true&q=*:*
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 242,
"max_score" : 1.0,
"hits" : [ { .....
$ curl http://localhost:9200/hx/_search?q=class:section
{"took":76,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":4.135494,"hits":[{"_index":"hx","_type":"logs","_id":"s1","_score":4.135494,"_source":{"doc":{"name":"Surgical History ","class":"Section","columns":[{"questiongroups":["qg1","qg2"]},{"questiongroups":["qg3","qg4"]}]},"doc_as_upsert":true,"@version":"1","@timestamp":"2015-06-30T22:09:15.176Z"}}]}}
$ curl http://localhost:9200/hx/_search?q=_id:s1
{"took":68,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":1.0,"hits":[{"_index":"hx","_type":"logs","_id":"s1","_score":1.0,"_source":{"doc":{"name":"Surgical History ","class":"Section","columns":[{"questiongroups":["qg1","qg2"]},{"questiongroups":["qg3","qg4"]}]},"doc_as_upsert":true,"@version":"1","@timestamp":"2015-06-30T22:09:15.176Z"}}]}}
//####################################################
Now, lets stop/start the ES container
//####################################################
$ docker stop elasticsearch
$ docker start elasticsearch
// Still 242 docs in the index
$ curl http://localhost:9200/hx/logs/_search?pretty=true&q=*:*
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 242,
"max_score" : 1.0,
"hits" : [ { .....
//But, we can NOT find it by class any more
$ curl http://localhost:9200/hx/_search?q=class:section
{"took":2,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}
//We CAN find it by _id
$ curl http://localhost:9200/hx/_search?q=_id:s1
{"took":128,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":1.0,"hits":[{"_index":"hx","_type":"logs","_id":"s1","_score":1.0,"_source":{"doc":{"name":"Surgical History ","class":"Section","columns":[{"questiongroups":["qg1","qg2"]},{"questiongroups":["qg3","qg4"]}]},"doc_as_upsert":true,"@version":"1","@timestamp":"2015-06-30T12:29:05.292Z"}}]}}
//We CAN find it by doc.class
curl http://localhost:9200/hx/_search?q=doc.class:section
{"took":2,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":4.135494,"hits":[{"_index":"hx","_type":"logs","_id":"s1","_score":4.135494,"_source":{"doc":{"name":"Surgical History ","class":"Section","columns":[{"questiongroups":["qg1","qg2"]},{"questiongroups":["qg3","qg4"]}]},"doc_as_upsert":true,"@version":"1","@timestamp":"2015-06-30T22:09:15.176Z"}}]}}
curl -XGET 'localhost:9200'
{
"status" : 200,
"name" : "Nosferata",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "1.4.5",
"build_hash" : "2aaf797f2a571dcb779a3b61180afe8390ab61f9",
"build_timestamp" : "2015-04-27T08:06:06Z",
"build_snapshot" : false,
"lucene_version" : "4.10.4"
},
"tagline" : "You Know, for Search"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment