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
require 'action_dispatch/routing/route_set' | |
# Based on https://gist.github.com/2830082 | |
module ActionDispatch | |
module Routing | |
class RouteSet | |
class Dispatcher | |
def call_with_invalid_char_handling(env) | |
uri = CGI::unescape(env["REQUEST_URI"].force_encoding("UTF-8")) | |
# If anything in the REQUEST_URI has an invalid encoding, then raise since it's likely to trigger errors further on. | |
return [400, {'X-Cascade' => 'pass'}, []] if uri.is_a?(String) and !uri.valid_encoding? |
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
# verify we are allowing unmapped fields | |
curl -s -XGET '/_nodes?pretty=true' | grep allow_unmapped | |
# "allow_unmapped_fields" : "true" | |
# delete the index | |
curl -XDELETE 127.0.0.1:9200/test1 | |
# create index with explicit mapping only for user field | |
curl -XPUT 127.0.0.1:9200/test1 -d ' | |
{ |
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
tenth, 10th: | |
note: Added and approved ordinal number set. AFF 10/7/14 | |
status: Approved | |
ninth, 9th: | |
note: Added and approved ordinal number set. AFF 10/7/14 | |
status: Approved |
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
tenth, 10th: | |
locale: English | |
note: Added and approved ordinal number set. AFF 10/7/14 | |
status: Approved | |
visas, visa: | |
locale: Spanish | |
note: Approved AFF 2/6/14. | |
status: Approved |
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
{ | |
"aggs": { | |
"album_agg": { | |
"terms": { | |
"field": "album", | |
"order": { | |
"top_score": "desc" | |
} | |
}, | |
"aggs": { |
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
GET http://localhost:9200/development-asis-flickr_photos/_search | |
{ | |
"query": { | |
"filtered": { | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"more_like_this": { | |
"fields": [ |
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
{ | |
"suggest": { | |
"text": "jeferson memorial", | |
"suggestion": { | |
"phrase": { | |
"analyzer": "bigram_analyzer", | |
"field": "bigram", | |
"size": 1, | |
"direct_generator": [ | |
{ |
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
{ | |
"properties": { | |
"bigram": { | |
"type": "string", | |
"analyzer": "bigram_analyzer" | |
}, | |
"caption": { | |
"type": "string", | |
"analyzer": "en_analyzer", | |
"copy_to": [ |
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
{ | |
"properties": { | |
"bigram": { | |
"type": "string", | |
"analyzer": "bigram_analyzer" | |
}, | |
"description": { | |
"type": "string", | |
"analyzer": "en_analyzer", | |
"copy_to": [ |
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
{ | |
"bool": { | |
"should": [ | |
{ | |
"match": { | |
"tags": { | |
"query": "jefferson memorial", | |
"analyzer": "tag_analyzer" | |
} | |
} |