我這里為什么會查出四條
{
? "took": 23,
? "timed_out": false,
? "_shards": {
? ? "total": 5,
? ? "successful": 5,
? ? "skipped": 0,
? ? "failed": 0
? },
? "hits": {
? ? "total": 4,
? ? "max_score": 2.7725887,
? ? "hits": [
? ? ? {
? ? ? ? "_index": "book",
? ? ? ? "_type": "novel",
? ? ? ? "_id": "1",
? ? ? ? "_score": 2.7725887,
? ? ? ? "_source": {
? ? ? ? ? "word_count": 200000,
? ? ? ? ? "author": "李四",
? ? ? ? ? "title": "三國演義",
? ? ? ? ? "publish_date": "2018-05-22"
? ? ? ? }
? ? ? },
? ? ? {
? ? ? ? "_index": "book",
? ? ? ? "_type": "novel",
? ? ? ? "_id": "2",
? ? ? ? "_score": 1.8800145,
? ? ? ? "_source": {
? ? ? ? ? "word_count": 100000,
? ? ? ? ? "author": "張三",
? ? ? ? ? "title": "三國演義",
? ? ? ? ? "publish_date": "2018-03-22"
? ? ? ? }
? ? ? },
? ? ? {
? ? ? ? "_index": "book",
? ? ? ? "_type": "novel",
? ? ? ? "_id": "4",
? ? ? ? "_score": 1.8800145,
? ? ? ? "_source": {
? ? ? ? ? "word_count": 13040,
? ? ? ? ? "author": "韓梅梅",
? ? ? ? ? "title": "三國演義",
? ? ? ? ? "publish_date": "1998-03-22"
? ? ? ? }
? ? ? },
? ? ? {
? ? ? ? "_index": "book",
? ? ? ? "_type": "novel",
? ? ? ? "_id": "9",
? ? ? ? "_score": 0.84290016,
? ? ? ? "_source": {
? ? ? ? ? "word_count": 23422340,
? ? ? ? ? "author": "董潔",
? ? ? ? ? "title": "演員的自我修養",
? ? ? ? ? "publish_date": "2012-08-22"
? ? ? ? }
? ? ? }
? ? ]
? }
}
2018-05-03
因為match是模糊匹配查詢,查詢的時候不是整詞匹配的 而是匹配“三”“國”“演”“義”這四個字分開匹配,之前幾本書都叫三國演義,相當于全匹配了,演員的自我修養剛好有演字,所以也匹配上了,如果有圖書名帶三國演義中的任意一個或幾個字也是都可以匹配出來的,看下一節老師講的內容 就能明白了
2018-11-14
我的想法是用NGram分詞器一字一詞的進行分詞,然后用match_phrase短語查詢去查,這樣應該就能達到完全匹配