Skip to content

Instantly share code, notes, and snippets.

@blooberr
Created June 11, 2014 19:19
Show Gist options
  • Save blooberr/0ea66f9676a7b987b44a to your computer and use it in GitHub Desktop.
Save blooberr/0ea66f9676a7b987b44a to your computer and use it in GitHub Desktop.

Revisions

  1. blooberr created this gist Jun 11, 2014.
    21 changes: 21 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    myhost = "localhost"

    @es = Elasticsearch::Client.new host: myhost, port: 9200, log: true

    @es.create index: "hello",
    type: "world",
    id: "someitem",
    body: {
    text: "yup",
    count: 1
    }

    @es.indices.put_alias index: "hello", name: "alias-hello"

    @es.search index: "alias-hello"

    @es.indices.close index: "alias-hello"

    @es.search index: "alias-hello", ignore_unavailable: true ## throws error

    @es.search index: "xxxxzzzzwrongindex", ignore_unavailable: true ## doesn't throw error. Expected behavior.