-
-
Save nickhoffman/0cbe6892b4bc720bda92 to your computer and use it in GitHub Desktop.
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 PUT 'localhost:9200/development_products?pretty=true' -d ' | |
{ | |
"settings": { | |
"analysis": { | |
"filter": { | |
"3_8_ngram": { | |
"type": "nGram", | |
"min_gram": 3, | |
"max_gram": 8 | |
} | |
}, | |
"analyzer": { | |
"ascii_3_8_ngram": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": [ "standard", "lowercase", "asciifolding", "3_8_ngram" ] | |
}, | |
"ascii_std": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": [ "standard", "lowercase", "asciifolding" ] | |
} | |
} | |
} | |
} | |
} | |
' |
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 PUT 'localhost:9200/development_products/product/_mapping?pretty=true' -d ' | |
{ | |
"product": { | |
"properties": { | |
"id": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"name": { | |
"include_in_all": false, | |
"analyzer": "ascii_3_8_ngram", | |
"boost": 4.0, | |
"type": "string" | |
}, | |
"number": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"properties": { | |
"properties": { | |
"Package Type": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"character": { | |
"include_in_all": false, | |
"analyzer": "ascii_3_8_ngram", | |
"boost": 2.0, | |
"type": "string" | |
} | |
} | |
}, | |
"items": { | |
"properties": { | |
"id": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"item_number": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"name": { | |
"include_in_all": false, | |
"analyzer": "ascii_3_8_ngram", | |
"boost": 2.0, | |
"type": "string" | |
} | |
} | |
}, | |
"catalog": { | |
"properties": { | |
"id": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"name": { | |
"include_in_all": false, | |
"analyzer": "ascii_3_8_ngram", | |
"type": "string" | |
}, | |
"number": { | |
"index": "not_analyzed", | |
"type": "string" | |
} | |
} | |
}, | |
"_all": { | |
"analyzer": "ascii_std", | |
"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
curl -X POST 'http://localhost:9200/development_products/product/4e6299c3349c301b290002ed?pretty=true' -d ' | |
{ | |
"name": "Grimlock", | |
"number": "TFG1S2-15", | |
"properties": { | |
"Package Type": "MISB", | |
"Manufacturer": "Hasbro" | |
}, | |
"catalog": { | |
"name": "Series 2", | |
"number": "TFG1S2" | |
}, | |
"items": [ | |
{ "name": "Grimlock" } | |
] | |
} | |
' | |
curl -X POST 'http://localhost:9200/development_products/product/4e725af9349c301b55000154?pretty=true' -d ' | |
{ | |
"name": "Japanese, Norwegian, Indian Collector Edition Gift Set", | |
"number": "BB-DOTW-56", | |
"properties": { | |
"Product #": "BB-DOTW-56", | |
"Edition": "Collector Edition" | |
}, | |
"catalog": { | |
"name": "Dolls of The World", | |
"number": "BB-DOTW" | |
}, | |
"items": [ | |
{ "name": "Japanese Barbie" }, | |
{ "name": "Left Tabi - Short Sock" }, | |
{ "name": "Right Tabi - Short Sock" } | |
] | |
} | |
' |
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 GET 'http://localhost:9200/development_products/product/_search?pretty=true' -d ' | |
{ | |
"from": 0, | |
"size": 5, | |
"fields": ["name"], | |
"query": { | |
"dis_max": { | |
"queries": [ | |
{ "field": { "name": "grimlock" } }, | |
{ "field": { "catalog.name": "grimlock" } }, | |
{ "field": { "items.name": "grimlock" } }, | |
{ "field": { "properties.character": "grimlock" } }, | |
{ "field": { "_all": "grimlock" } } | |
] | |
} | |
} | |
} | |
' | |
{ | |
"took" : 5, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 2, | |
"max_score" : 0.32361695, | |
"hits" : [ { | |
"_index" : "development_products", | |
"_type" : "product", | |
"_id" : "4e6299c3349c301b290002ed", | |
"_score" : 0.32361695, | |
"fields" : { | |
"name" : "Grimlock" | |
} | |
}, { | |
"_index" : "development_products", | |
"_type" : "product", | |
"_id" : "4e725af9349c301b55000154", | |
"_score" : 0.0013837139, | |
"fields" : { | |
"name" : "Japanese, Norwegian, Indian Collector Edition Gift Set" | |
} | |
} ] | |
} | |
} |
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 GET 'http://localhost:9200/development_products/product/_search?pretty=true' -d ' | |
{ | |
"from": 0, | |
"size": 5, | |
"fields": ["name"], | |
"query": { | |
"dis_max": { | |
"queries": [ | |
{ "field": { "name": "grixlock" } }, | |
{ "field": { "catalog.name": "grixlock" } }, | |
{ "field": { "items.name": "grixlock" } }, | |
{ "field": { "properties.character": "grixlock" } }, | |
{ "field": { "_all": "grixlock" } } | |
] | |
} | |
} | |
} | |
' | |
{ | |
"took" : 5, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 2, | |
"max_score" : 0.011741202, | |
"hits" : [ { | |
"_index" : "development_products", | |
"_type" : "product", | |
"_id" : "4e6299c3349c301b290002ed", | |
"_score" : 0.011741202, | |
"fields" : { | |
"name" : "Grimlock" | |
} | |
}, { | |
"_index" : "development_products", | |
"_type" : "product", | |
"_id" : "4e725af9349c301b55000154", | |
"_score" : 0.0013837139, | |
"fields" : { | |
"name" : "Japanese, Norwegian, Indian Collector Edition Gift Set" | |
} | |
} ] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment