I have document like this: 

{"Title":"This is my test title"} 

This question was asked before, but my reply to the original post was never 
accepted by the mailing list. So, sorry to re-ask same question again on a 
new post.

I want to return the doc with exactly matched title, but allowing case 
insensitive and redundant white space between words. That is, all of these 
queries: "this is my test TITLE", "this is my test title" and "this is     
     my test title" will match the doc. 

My initial idea is to define a custom analyzer with keyword tonenizer and 
lowercase filter: 
    "settings" : { 
        "analysis" : { 
            "analyzer" : { 
                "lowercase_keyword" : { 
                    "type" : "custom", 
                    "tokenizer" : "keyword", 
                    "filter" : "lowercase" 
                } 
            } 
        } 
    } 

and use lowercase_keyword analyzer for title filed: 
        "properties" : { 
          "title" : { 
            "type" : "string", 
            "analyzer" : "lowercase_keyword" 
          } 
        } 

It works well for both "this is my test TITLE" and "this is my test title". 
But does not work for redundant white spaces case like "this is          my 
test title". 

How can I define my custom analyzer to achieve my goal? 

Thanks!

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/3895e674-0434-4905-8279-5cdb4a7bc22d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to