1

I want to do prefix fuzzy search on single term. Basically I want to get same result as if this search request has been sent:

{
  "from": 0,
  "size": 100,
  "query": {
    "query_string": {
      "query": "dala~*"
    }
  },
  "filter": {}
}

but without query_string syntax parsing. Search above should match to Dallas term.

Vitaliy Kalinin
  • 1,791
  • 12
  • 20
  • http://stackoverflow.com/questions/2631206/lucene-query-bla-match-words-that-start-with-something-fuzzy-how – phanin Mar 07 '13 at 14:09
  • "dala~*" query string definitely works for me and Elastc Search documentation states that internal query string is parsed into combination of simplier query conditions. So I am looking if someone can shed some light to which combination of queries it will be parsed. – Vitaliy Kalinin Mar 07 '13 at 15:31
  • After further testing it looks like this query "dala~*" doesn't work as expected, i.e. it splits it on 2 parts "dala~" and "*". And due to last term all documents are matched. But I am still intersted if it is possible to get both partial and fuzzy matching. – Vitaliy Kalinin Mar 07 '13 at 17:51
  • Lucene version you are using?? – phanin Mar 07 '13 at 18:02
  • I am using latest ElasticSearch – Vitaliy Kalinin Mar 07 '13 at 18:08
  • http://lucene.apache.org/core/4_1_0/queryparser/org/apache/lucene/queryparser/analyzing/AnalyzingQueryParser.html – phanin Mar 07 '13 at 18:10

1 Answers1

-1

In ElasticSearch, if you set fuzzy_prefix_length, you should be able to specify just the fuzzy tilde and get prefix matching:

{
  "from": 0,
  "size": 100,
  "query": {
    "query_string": {
      "query": "dala~",
      "fuzzy_prefix_length": 3
    }
  },
  "filter": {}
}

Similar in spirit to this question

Community
  • 1
  • 1
Zach
  • 9,591
  • 1
  • 38
  • 33