2017-09-27 78 views
0

我不明白爲什麼突出顯示不起作用。該查詢可以正常顯示,但只顯示沒有電子標籤的字段內容。這裏是我的設置和映射:彈性搜索突出顯示不使用自定義分析器/標記器

PUT wmsearch 
{ 
    "settings": { 
    "index.mapping.total_fields.limit": 2000, 
    "analysis": { 
     "analyzer": { 
     "custom": { 
      "type": "custom", 
      "tokenizer": "custom_token", 
      "filter": [ 
      "lowercase" 
      ] 
     }, 
     "custom2": { 
      "type": "custom", 
      "tokenizer": "keyword", 
      "filter": [ 
      "lowercase" 
      ] 
     } 
     }, 
     "tokenizer": { 
     "custom_token": { 
      "type": "ngram", 
      "min_gram": 3, 
      "max_gram": 10 
     } 
     } 
    } 
    }, 
    "mappings": { 
    "doc": { 
     "properties": { 
     "document": { 
      "properties": { 
      "reference": { 
       "type": "text", 
       "analyzer": "custom" 
      } 
      } 
     }, 
     "scope" : { 
      "type" : "nested", 
      "properties" : { 
      "level" : { 
       "type" : "integer" 
      }, 
      "ancestors" : { 
       "type" : "keyword", 
       "index" : "true" 
      }, 
      "value" : { 
       "type" : "keyword", 
       "index" : "true" 
      }, 
      "order" : { 
       "type" : "integer" 
      }  
      } 
     } 
     } 
    } 
    } 
} 

這裏是我的查詢:

GET wmsearch/_search 
{ 
    "query": { 
    "simple_query_string" : { 
     "fields": ["document.reference"], 
     "analyzer": "custom2", 
     "query" : "bloom" 
    } 
    }, 
    "highlight" : { 
    "fields" : { 
     "document.reference" : {} 
    } 
    } 
} 

查詢並返回正確的結果和結果中突出顯示字段存在。但是,「bloom」周圍沒有em標籤。相反,它只是顯示了完全沒有標籤的字符串。

有沒有人在這裏看到任何問題或可以幫助? 「補償」我的映射document.reference:

感謝

回答

0

我把它加入「index_options」工作。

相關問題