2014-12-07 94 views
0

我無法讓ElasticSearch突出顯示使用elasticsearch-mapper-attachments索引的附件內容中的點擊數。使用ElasticSearch突出顯示附件內容中的點擊數

我在/stuff/file數據是這樣的:

{ 
    "id": "string" 
    "name": "string" 
    "attachment": "...base 64 encoded file" 
} 

我的映射器配置投入/stuff/file/_mapper看起來是這樣的:

{ 
    "file" : { 
     "properties" : { 
      "attachment" : { 
       "type" : "attachment", 
       "path" : "full", 
       "fields": { 
        "name": { "store": true }, 
        "title": { "store": true }, 
        "content": { "store": true }, 
        "attachment": { 
         "type": "string", 
         "term_vector": "with_positions_offsets", 
         "store": true 
        } 
       } 
      } 
     } 
    } 
} 

當我在/stuff/_mapper/file查詢它,我得到這個返回:

{ 
    "stuff":{ 
     "mappings":{ 
     "file":{ 
      "properties":{ 
       "attachment":{ 
        "type":"attachment", 
        "path":"full", 
        "fields":{ 
        "attachment":{ 
         "type":"string" 
        }, 
        "author":{ 
         "type":"string" 
        }, 
        "title":{ 
         "type":"string" 
        }, 
        "name":{ 
         "type":"string" 
        }, 
        "date":{ 
         "type":"date", 
         "format":"dateOptionalTime" 
        }, 
        "keywords":{ 
         "type":"string" 
        }, 
        "content_type":{ 
         "type":"string" 
        }, 
        "content_length":{ 
         "type":"integer" 
        }, 
        "language":{ 
         "type":"string" 
        } 
        } 
       }, 
       "id":{ 
        "type":"string" 
       }, 
       "name":{ 
        "type":"string" 
       } 
      } 
     } 
     } 
    } 
} 

而我的查詢看起來像t他:

{ 
    "size": 30, 
    "query": { 
     "multi_match": { 
      "query": "{{.Query}}", 
      "operator": "and", 
      "fields": ["id", "name^4", "attachment"], 
      "fuzziness": "AUTO", 
      "minimum_should_match": "80%" 
     } 
    }, 
    "highlight" : { 
     "fields" : { 
      "attachment": { } 
     } 
    } 
} 

當我搜索附件中的術語時,它會返回正確的結果,但沒有突出顯示。幾年前還有一個類似的問題,在幾個地方換了attachment代替file,但有人評論說這又改變了......什麼是正確的配置讓突出顯示工作?

+0

iam有同樣的問題...附件突出顯示不支持彈性搜索1.7? – 2016-06-10 11:41:38

回答

0

原來,您不能使用PUT覆蓋映射器配置。您需要先刪除現有的配置(我實際上已經刪除了整個數據庫,配置上的DELETE似乎沒有任何影響)。一旦映射器配置實際更新,突出顯示工作正常。