This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X DELETE "localhost:9200/companies" | |
curl -X PUT "localhost:9200/companies" -H 'Content-Type: application/json' -d' | |
{ | |
"settings": { | |
"analysis": { | |
"analyzer": { | |
"company_name_analyzer": { | |
"type": "custom", | |
"tokenizer": "standard", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X DELETE "localhost:9200/companies" | |
curl -X PUT "localhost:9200/companies" -H 'Content-Type: application/json' -d' | |
{ | |
"settings": { | |
"analysis": { | |
"analyzer": { | |
"company_name_analyzer": { | |
"type": "custom", | |
"tokenizer": "standard", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XDELETE 'localhost:9200/my-index?pretty' | |
curl -XPUT 'localhost:9200/my-index?pretty' -H 'Content-Type: application/json' -d' | |
{ | |
"mappings": { | |
"doc": { | |
"properties": { | |
"message": { | |
"type": "text" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROPER_NOUN_INDEX = { | |
"analysis" => { | |
"char_filter" => { | |
"proper_noun_char_filter" => { | |
"type" => "mapping", | |
"mappings" => ["'\''=>", "&=>_", "-=>_"] | |
} | |
}, | |
"analyzer" => { | |
"proper_noun" => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'pry' | |
if ARGV.first && !ARGV.first.index("-") && env = ARGV.shift | |
ENV['RAILS_ENV'] = %w(production development test).detect {|e| e =~ /^#{env}/} || env | |
end | |
ARGV.unshift "console" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XDELETE 127.0.0.1:9200/blog/ | |
curl -XPOST 127.0.0.1:9200/blog/ | |
# An article has a "title" field. Article has a nested mapping of comments, which has the fields "author" and "title". | |
curl -XPUT 127.0.0.1:9200/blog/article/_mapping -d ' | |
{ | |
"article": { | |
"properties":{ | |
"title": { | |
"type": "string", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveModel | |
module Typecasting | |
extend ActiveSupport::Concern | |
# | |
# class PoopFactory | |
# include ActiveModel::Model | |
# include ActiveModel::Typecasting | |
# | |
# typecast_accessor :color, type: :string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_scroll_id"=>"c2NhbjsxOzc4NjprWFFSS01qU1JOYXVmZ3MxN0dYQVVROzE7dG90YWxfaGl0czozOw==", | |
"took"=>2, | |
"timed_out"=>false, | |
"_shards"=>{ | |
"total"=>5, | |
"successful"=>2, | |
"failed"=>3, | |
"failures"=>[ | |
{"status"=>500, "reason"=>"SearchContextMissingException[No search context found for id [784]]"}, {"status"=>500, "reason"=>"SearchContextMissingException[No search context found for id [787]]"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p "Hello world" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@test_classes = {} | |
@@test_methods = {} | |
setup do | |
@start_time = Time.now | |
end | |
teardown do | |
delta = Time.now - @start_time |
NewerOlder