私はelasticsearchを用いたトップ検索クエリを作成したいです。elasticsearchにグローバルクエリを書き込む方法は?
elasticsearchテーブルからcategory_name
、brand_name
、title
と一致させたいと思います。試合はフレーズ、またはまたは条件でなければなりません。
マイクエリ:
$query = [
"bool" => [
"must" => [
["match" => ["is_published" => 1]],
[
"multi_match" => [
"query" => $searchKey,
"fields" => ["category_name", "brand_name", "title"]
]
],
[
'nested' => [
'path' => 'category_with_in_title.parent_cat',
'query' => [
'bool' => [
'must' => [
['match' => [
'category_with_in_title.parent_cat.status' => 1,
]],
],
],
],
],
],
[
'nested' => [
'path' => 'brand',
'query' => [
'bool' => [
'must' => [
'match' => [
'brand.approved_status' => 1,
],
],
],
],
],
],
[
'nested' => [
'path' => 'default_product_low_price_with_seller.seller_detail',
'query' => [
'bool' => [
'must' => [
'match' => [
'default_product_low_price_with_seller.seller_detail.approve_status' => 1,
],
],
],
],
],
],
[
'nested' => [
'path' => 'default_product_low_price_with_seller',
'query' => [
'bool' => [
'must' => [
'match' => [
'default_product_low_price_with_seller.status' => 1,
],
],
],
],
],
],
],
],
];
私はそのためのmulti_match
を使用しますが、どのようにこのクエリでpharseを使用しますか?私は検索するために一言を書かなければならない。例えば
:
は、私は、そのcategory_name = Tops
私が欲しい私が書く場合に生じる「トップス」または「トップ」または「へ」のレコードを検索したいです。しかし、今私は正確な単語 "トップス"を書く必要があります。
事前のおかげで...
このアプローチは、限界があります。デフォルトのmax_expansionsは50です。クエリの応答時間に影響する可能性があります。参考:https://www.elastic.co/guide/en/elasticsearch/guide/current/_query_time_search_as_you_type.html –
ありがとう先生、これは私はそれが動作するすべてのレコード –