Hi, I am trying to query for "fit pro" against my index where there is a document with "fitpro" on one of its fields. Decided to take the following approach with it:
- Create a reverse edgeNgram tokenizer - Used the edgeNgram tokenizer only of index_analyzer - Boost on match prefix and match (edgeNgram field) Am getting the result after couple of hits down the list. Playing with the weights is not changing much :/ Any help would be much appreciated. Index mapping is - 'settings':{ 'number_of_shards': 1, 'number_of_replicas': 0, "analysis": { "filter" : { "filter_edgeNgram" : { "type" : "edgeNGram", "min_gram" : "3", "max_gram" : "6", "token_chars": [ "letter", "digit" ] } }, "analyzer": { "analyzer_ngram_rev" : { "type":"custom", "tokenizer": "standard", "filter": ["standard", "lowercase", "asciifolding", "reverse", "filter_edgeNgram", "reverse"] }, "analyzer_stemmed" : { "tokenizer":"standard", "filter":["standard", "lowercase", "asciifolding", "kstem"] } } } } }, ignore=400 Query is - { "from" : 0, "size" : 60, "query" : { "function_score" : { "query" : { "filtered" : { "query" : { "bool" : { "should" : [ { "query_string" : { "query" : "fit~1 pro~1 ", "minimum_should_match" : "60%" } }, { "match" : { "name" : { "query" : "fit", "type" : "phrase_prefix" } } }, { "match" : { "name_ngram_fwd" : { "query" : "fit pro", "type" : "boolean" } } }, { "match" : { "name_stemmed" : { "query" : "fit pro", "type" : "boolean" } } } ] } }, "filter" : { "geo_distance" : { "location" : [ 41.880001068115234, -87.62000274658203 ], "distance" : "16km" } } } }, "functions" : [ { "filter" : { "geo_distance" : { "location" : [ 41.880001068115234, -87.62000274658203 ], "distance" : "16km" } }, "boost_factor" : 2.0 }, { "filter" : { "query" : { "query_string" : { "query" : "fit~1 pro~1 ", "minimum_should_match" : "60%" } } }, "boost_factor" : 1.0 }, { "filter" : { "query" : { "match" : { "name" : { "query" : "fit", "type" : "phrase_prefix" } } } }, "boost_factor" : 4.0 }, { "filter" : { "query" : { "match" : { "name_ngram_rev" : { "query" : "fit pro" } } } }, "boost_factor" : 6.0 }, { "filter" : { "query" : { "query_string" : { "query" : "fit pro" } } }, "boost_factor" : 2.0 } ], "score_mode" : "multiply" } }, "fields" : "_source", "script_fields" : { "distance" : { "script" : "doc['location'].distanceInKm(41.880001,-87.620003)" } } } -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9fefa584-ee2f-42e1-ae38-6fa494df5ddd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.