Skip to content

Instantly share code, notes, and snippets.

@ppearcy
Created November 8, 2011 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppearcy/1349777 to your computer and use it in GitHub Desktop.
Save ppearcy/1349777 to your computer and use it in GitHub Desktop.
Synonym search failure
curl -XDELETE 'http://localhost:9200/syntest/'
curl -XPOST localhost:9200/syntest -d '{
"settings" : {
"number_of_shards" : 1,
"analysis" : {
"analyzer": {
"syntest_analyzer":{"type":"custom","tokenizer":"standard","filter":["standard", "lowercase", "syntest_synonym", "stop", "english_snowball"]},
"syntest_analyzer_nosyn":{"type":"custom","tokenizer":"standard","filter":["standard", "lowercase", "stop", "english_snowball"]}, "dr_no_syn" : {"type":"custom","tokenizer":"standard","filter":["standard", "lowercase", "stop", "english_snowball"]}
},
"filter":
{
"syntest_synonym":{"type":"synonym","synonyms" : ["Gardasil,human papilloma virus vaccine,Cervarix"],"ignore_case":true,"expand":true, "tokenizer":"standard"},
"english_snowball":{"type":"snowball","language" : "English"}
}
}
},
"mappings" : {
"syntest" : {
"properties" : {
"name" : { "type" : "string", "omit_norms" : true, "include_in_all" : false, "index_analyzer" : "syntest_analyzer", "search_analyzer" : "syntest_analyzer_nosyn", "term_vector" : "with_positions_offsets"}
}
}
}
}'
curl -XPUT 'http://localhost:9200/syntest/syntest/1' -d '{
"name" : "DrugProfile - Gardasil - Vaccines/DecisionResourcesView"
}'
curl -XGET http://localhost:9200/syntest/_search?pretty=True -d ' {
"from":0,"size":10,"query":{"query_string":{"query":"((((name:(vaccines)) )))","default_operator":"or"},"fields":["_source.name"],"highlight":{"pre_tags":["<Highlight>"],"post_tags":["</Highlight>"],"fields":{"name":{"fragment_size":300,"number_of_fragments":1,"fragment_offset":100}}}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment