2014-03-06 27 views
2

我有這樣Elasticsearch比賽有多個值(數組)

{ 
      "_index": "entities", 
      "_type": "names", 
      "_id": "0000230799", 
      "_score": 1, 
      "_source": { 
       "FIRST_NAME": [ 
        "Deborah", 
        "Debbie" 
       ], 
       "LAST_NAME": "Jones" 
      } 
     } 

我嘗試對名稱的匹配查詢的索引,但除非第一個名字是準確的,沒有命中返回

我期待下面的查詢生成至少一個命中並對它進行評分,我錯了嗎?

curl -XPOST 'http://localhost:9200/entities/names/_search?pretty=true' -d ' 

{ 
"query": { 

      "match":{ 
       "FIRST_NAME":"Deb" 
       } 
     } 

}' 

我的映射是

{ 
    "entities": { 
     "mappings": { 
     "names": { 
      "_parent": { 
       "type": "entity" 
      }, 
      "_routing": { 
       "required": true 
      }, 
      "properties": { 
       "FIRST_NAME": { 
        "type": "string" 
       }, 
       "LAST_NAME": { 
        "type": "string" 
       } 
      } 
     } 
     } 
    } 
} 

回答

3

這裏的問題是不相關的多個值,但你的假設match -query將匹配任何你輸入啓動。它不是。

在匹配系列查詢中有match_phrase_prefix值得檢查。它在這裏更詳細地解釋:http://www.elasticsearch.org/blog/starts-with-phrase-matching/

還有prefix-查詢,但請注意,它不做任何文本分析。

對於一般的介紹文本分析,我可以推薦這兩篇文章:

+0

謝謝你,我會深入探討,看看什麼東西 –