Skip to content

Instantly share code, notes, and snippets.

class ElasticSearchUserError < StandardError
def initialize(failures)
@failures = failures
end
def to_s
"Failures:\n#{PP.pp @failures, ""}"
end
end
% curl -XDELETE http://localhost:9200/test/
{"ok":true,"acknowledged":true}
% curl -XPUT http://localhost:9200/test/
{"ok":true,"acknowledged":true}
% curl -XPUT http://localhost:9200/test/test/1?refresh=true -d {"foo":"1", "bar":"a"}
{"ok":true,"_index":"test","_type":"test","_id":"1","_version":1}
% curl -XPUT http://localhost:9200/test/test/1?refresh=true -d {"foo":"1", "bar":"bc"}
% curl -XDELETE http://localhost:9200/test/
{"ok":true,"acknowledged":true}
% curl -XPUT http://localhost:9200/test/
{"ok":true,"acknowledged":true}
% curl -XPUT http://localhost:9200/test/test/_mapping \
-d {"test":{"properties":{"bar":{"type":"string","index":"not_analyzed"}}}}
{"ok":true,"acknowledged":true}
#!/bin/sh
set -e
URL="http://localhost:9200"
function run() {
echo "%" "$@"
"$@"
echo
alt p.find_all(["name", "uuid", "url", "method"]) {
ok([name, uuid, url, method]) { ... }
err(missing) { warn("Malformed source json: " + str::concat(missing), " ") }
}
all: libfoo.a
foo.o: foo.c
gcc -c -fPIC -o $@ $<
libfoo.a: foo.o
ar -r $@ $<
#0 0x00007fff83746c0a in kevent ()
#1 0x00000001005a45f5 in kq_dispatch ()
#2 0x0000000100593cdc in event_base_loop ()
#3 0x000000010058257a in libcouchbase_wait ()
#4 0x00000001002f5824 in cb_bucket_init ()
#5 0x000000010016d034 in vm_call0 ()
#6 0x00000001001721ee in rb_funcall2 ()
#7 0x00000001002f4bc7 in cb_bucket_new ()
#8 0x00000001001779c3 in vm_call_method ()
#9 0x0000000100162d23 in vm_exec_core ()
// With these settings I get this:
// setlocal cindent
// setlocal cinkeys-=:,0#
type t = {
a: b,
c: d,
}
// But I'd prefer this:
type t = {
#0 0x0000000101102634 in upcall_fail ()
#1 0x000000010042dbc2 in option::get4985::_297bf067eb75badb ()
#2 0x000000010042daff in map::chained::hashmap::get4984::_905fde99901235f3 ()
#3 0x00000001003d934f in middle::trans::debuginfo::create_function::_495d97529d3b43c1 ()
#4 0x0000000100429e79 in middle::trans::debuginfo::create_block::_3f10e849dc2d318a ()
#5 0x00000001007c5342 in __morestack ()
#6 0x00000001004298ec in middle::trans::debuginfo::create_block::_3f10e849dc2d318a ()
#7 0x000000010039c4a1 in middle::trans::base::trans_block::_c4b5741ad8179b66 ()
#8 0x00000001003d8565 in middle::trans::base::trans_closure::_2ee366e71ddd7828 ()
#9 0x00000001003ab77b in middle::trans::base::trans_fn::_34c57fb9cb46d7f4 ()
module Tire
module Scroll
DEFAULT_SCROLL_DURATION = '1m'
class Scroll
attr_reader :search, :total, :remaining, :counter
def initialize(indices=nil, options={}, &block)
@search = Tire::Search::Search.new(indices, options, &block)
@options = options