ruby - How do I search words seperated by _ and . in ElasticSearch? -
i new elasticsearch , happy speed @ moment. still have 1 requirement haven't been able achieve.
elasticsearch seems split following text when doing indexing:
"bmw.co.uk" "apple_macbook_pro"
i searching in ruby using elasticsearch gem:
result = client.search index: 'elasticsearch_dev', body: { query: { "bool" => { "must" => {"match" => {"search_text" => {"query" => "bmw", "operator" => "and"}}}, "must_not" => {"match" => {"search_text" => {"query" => "", "operator" => "or"}}} } }, }
what i'm trying achieve:
when search 'bmw' or 'bmw.co', want records bmw.co.uk
match.
when search 'acboo' or 'apple', want records apple_macbook_pro
match.
how go achieving this?
addtional info
i have looked @ site, along lines of looking do, not quite:
if have url:
uk-on-sale.com
i want tokenized as:
[uk, on, sale, com, uk-on, on-sale, uk-on-sale.com, on-sale.com, sale.com, .com]
have tried "match_phrase"
query ?
Comments
Post a Comment