Fuzzy Query With Wildcard


(Ronaldiscool) #1

Is there a way to do a fuzzy search with a wildcard token as well. So for example, if I searched *lap, anything can map to * without any penalty and then I still have one more edit that I can use on the rest of the word.


(Adrien Grand) #2

There is no query for this. However, you could use an index-time solution to this problem that would consist in populating a field with only the last 3 chars of every token (using edge n-grams) and then run a fuzzy query on this field.


(Ronaldiscool) #3

How do you use an edgeNGram tokenizer for a suffix query? Currently when I try to build my index, the following query does not yield anything:

curl -XPUT 'localhost:9200/freqreverse' -d '
{
"settings": {
"number_of_shards": 1,
"analysis": {
"tokenizer": {
"ngram_tokenizer": {
"type": "edgeNGram",
"min_gram": 3,
"max_gram": 20
}
},
"analyzer": {
"ngram_tokenizer_analyzer": {
"type": "custom",
"tokenizer": "ngram_tokenizer", "filter":["reverse","edgeNGram", "reverse"] } } } },
"mappings": {
"freq": {
"properties": {
"word_name": {
"type": "string",
"term_vector": "yes",
"analyzer": "ngram_tokenizer_analyzer" } } } }}'


(system) #4