问题
Is it possible to configure the elasticsearch index behavior to ack as the LIKE keyword of SQL.
If the index contains "This document is called MySuperInvoice", I want to be able to find it if I am looking for super, doc or voice"
Thank you for your help.
Edit:
Somebody tells me that I need to put * around my search terms : *query*
Lets see how this can be done using haystack.
回答1:
Ok I finally got there. Thanks @zebuline.
cluster:
name: webapp
network:
bind_host: 0.0.0.0
publish_host: _eth0_
index:
analysis:
analyzer:
default_index:
type: custom
tokenizer: standard
filter: [standard, lowercase, asciifolding, webapp_ngram]
default_search:
type: custom
tokenizer: standard
filter: [standard, lowercase, asciifolding]
filter:
webapp_ngram:
type: nGram
min_gram: 1
max_gram: 30
回答2:
Have a look at default mapping in ES. It should help you.
http://www.elasticsearch.org/guide/reference/mapping/dynamic-mapping.html
来源:https://stackoverflow.com/questions/14160295/configure-elasticsearch-to-use-ngram-by-default-sql-like-behavior