2017-02-23 40 views
0
$results=$client->search([ 
       'index' => 'my_index', 
       'type' => 'my_type', 
       'body' => [ 
        'query' => [ 
         "multi_match" => [ 
          "fields" =["column1","column2","column3"], 
          "query" => "Test", 
          "type" => "phrase_prefix" 

         ] 
        ] 
       ] 
      ]); 

我正在使用elasticsearch和laravel.How如何使上面的代码不区分大小写。ElasticSearch - 在not_analyzed上不区分大小写的搜索

+0

查找到multifields https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html –

回答

0

将以下设置添加到您的索引。这将采取不区分大小写。

PUT - /index_name/_settings 

{ 
    "settings": { 
    "analysis": { 
     "analyzer": { 
     "custom_ta_analyzer": { 
      "tokenizer": "keyword", 
      "filter": [ "lowercase" ] 
     } 
     } 
    } 
    } 
} 
+0

谢谢你这么多的reply..when我运行使用感的工具,然后它给错误 { “错误”:{ “ROOT_CAUSE”:[{ “类型”: “action_request_validation_exception”, “原因”: “验证失败:1:不设置来更新;” } ], “type”:“action_request_validation_exception”, “reason”:“验证失败:1:没有要更新的设置;” }, “status”:400 } – Nirdesh