2016-06-14 62 views
0

我想在多個字段中使用yii2-elasticsearch進行全文搜索,其中所有字段都使用指定的分析器在文檔中進行檢查。分析器用於Elasticsearch多字多字段搜索中的映射

所以,如果我有一個映射:

"settings": { 
     "analysis": { 
      "analyzer": { 
      "lowercase_keyword": { 
       "tokenizer": "keyword", 
       "filter": [ "lowercase"] 
      } 
      } 
     } 
     }, 
    "mappings" : { 
     "typeName" :{  
      "properties" : { 
      "id" : { 
       "type" : "string", 
       "index" : "not_analyzed" 
      }, 
      "company_name" : { 
       "type" : "string", 
       "index" : "analyzed", 
       "analyzer" : "lowercase_keyword", 
      }, 
      "product_name" : { 
       "type" : "string", 
       "index" : "analyzed", 
       "analyzer" : "lowercase_keyword", 
      }, 
      "product_desc" : { 
       "type" : "string", 
       "index" : "not_analyzed" 
      },  
      } 
     } 
     } 
    } 

我想搜索在COMPANY_NAME,PRODUCT_NAME,product_desc一個字。

回答