단어의 일부 또는 단어의 시작 부분을 검색 할 수있는 신축성있는 검색을 설정하는 방법.elasticsearch로 단어의 시작 부분을 검색하는 방법은 무엇입니까?
다음 스크립트를 실행하면 'inte *'가 아닌 이상 접두어 'inte'를 찾지 못합니다.
여기에 무슨 문제가 있는지 알 수 없습니다. 당신이 here을 볼 수
echo "--- DELETING OLD INDEX ---"
curl -XDELETE 'http://localhost:9200/searchtest?pretty'
echo "--- CREATING INDEX ---"
curl -XPUT 'http://127.0.0.1:9200/searchtest/?pretty=1' -d '{
"mappings" : {
"mytype" : {
"properties" : {
"description": {
"type": "string",
"index_analyzer": "my_analyzer",
"search_analyzer": "standard"
}
}
}
},
"settings" : {
"analysis" : {
"analyzer" : {
"my_analyzer" : {
"filter" : [ "standard", "lowercase", "stop" ],
"type" : "custom",
"tokenizer" : "my_tokenizer"
}
},
"tokenizer" : {
"my_tokenizer" : {
"side" : "front",
"max_gram" : 200,
"type" : "edgeNGram"
}
}
}
}
}'
echo "--- INSERTING RECORDS ---"
curl -XPOST 'http://localhost:9200/searchtest/mytype?pretty=1' -d '{
"description": "Programming International!"
}'
curl -XPOST 'http://localhost:9200/searchtest/mytype?pretty=1' -d '{
"description": "i18n is internationalizatin"
}'
echo "--- REFRESH ---"
curl -XPOST 'http://localhost:9200/_refresh?pretty=1'
echo "--- RUNNING QUERY WITH * ---"
curl -XGET 'http://localhost:9200/searchtest/mytype/_search?pretty' -d '
{
"query" : {
"query_string" : {
"query" : "inte*"
}
}
}'
echo "--- RUNNING QUERY ---"
curl -XGET 'http://localhost:9200/searchtest/mytype/_search?pretty' -d '
{
"query" : {
"query_string" : {
"query" : "inte"
}
}
}'
그 아무 문제가 없습니다
아래와 같이 와일드 카드 쿼리보다 확장 성이 좋습니다. – Nate