Last active
December 20, 2015 11:00
-
-
Save joren/6120272 to your computer and use it in GitHub Desktop.
Elasticsearch problem
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
settings analysis: { | |
filter: { | |
myNgram: { | |
type: 'nGram', | |
max_gram: 12, | |
min_gram: 3 | |
} | |
}, | |
analyzer: { | |
name_analyzer: { | |
tokenizer: 'standard', | |
filter: %w[lowercase myNgram], | |
type: 'custom' | |
}, | |
} | |
} |
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 -XGET 'localhost:9200/_analyze?analyzer=name_analyzer&index=clients' -d 'jm brun' ruby-2.0.0 | |
{"tokens":[{"token":"bru","start_offset":3,"end_offset":6,"type":"word","position":1},{"token":"run","start_offset":4,"end_offset":7,"type":"word","position":2},{"token":"brun","start_offset":3,"end_offset":7,"type":"word","position":3}]}% | |
~ curl -XGET 'localhost:9200/_analyze?analyzer=name_analyzer&index=clients' -d 'jore' ruby-2.0.0 | |
{"tokens":[{"token":"jor","start_offset":0,"end_offset":3,"type":"word","position":1},{"token":"ore","start_offset":1,"end_offset":4,"type":"word","position":2},{"token":"jore","start_offset":0,"end_offset":4,"type":"word","position":3}]}% |
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 GET 'http://localhost:9200/clients/client/_search?load=true&size=4&pretty' -d '{"query":{"query_string":{"query":"name:jore"}},"size":4}' ruby-2.0.0 | |
{ | |
"took" : 2, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 12, | |
"max_score" : 2.2767696, | |
"hits" : [ { | |
"_index" : "clients", | |
"_type" : "client", | |
"_id" : "273", | |
"_score" : 2.2767696, "_source" : {"name":"Joren De Groof","shortname":"joren"} | |
}, { | |
"_index" : "clients", | |
"_type" : "client", | |
"_id" : "1070", | |
"_score" : 1.1383848, "_source" : {"name":"jorendegroof","shortname":"jorendegroof"} | |
} ] | |
} | |
}% | |
~ curl -X GET 'http://localhost:9200/clients/client/_search?load=true&size=4&pretty' -d '{"query":{"query_string":{"query":"jore"}},"size":4}' ruby-2.0.0 | |
{ | |
"took" : 1, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 0, | |
"max_score" : null, | |
"hits" : [ ] | |
} | |
}% |
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 GET 'http://localhost:9200/clients/client/_search?load=true&size=4&pretty' -d '{"query":{"query_string":{"query":"name:jm brun"}},"size":4}' ruby-2.0.0 | |
{ | |
"took" : 2, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 0, | |
"max_score" : null, | |
"hits" : [ ] | |
} | |
}% | |
~ curl -X GET 'http://localhost:9200/clients/client/_search?load=true&size=4&pretty' -d '{"query":{"query_string":{"query":"jm brun"}},"size":4}' ruby-2.0.0 | |
{ | |
"took" : 2, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 1, | |
"max_score" : 0.6683317, | |
"hits" : [ { | |
"_index" : "clients", | |
"_type" : "client", | |
"_id" : "65", | |
"_score" : 0.6683317, "_source" : {"name":"JM Bruneau","shortname":"jm_bruneau"} | |
} ] | |
} | |
}% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment