This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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", |
OlderNewer