company:
mappings:
id: { boost: 1, type: string, index: not_analyzed }
cik: { boost: 2, type: string, index: not_analyzed }
conformedName: { boost: 6, analyzer: custom_analyzer }
assignedSIC:
type: object
properties:
id: { type: string, index: not_analyzed }
code: { type: string, index: not_analyzed }
title: { analyzer: custom_analyzer }
businessAddress:
type: object
properties:
street1: { analyzer: custom_analyzer }
street2: { analyzer: custom_analyzer }
city: { analyzer: custom_analyzer }
state: { analyzer: custom_analyzer }
zip: { type: string, index: not_analyzed }
phone: { type: string, index: not_analyzed }
ネストされたbusinessAddressプロパティの都市、州、および郵便番号でフィルタしたいと思います。私はsintaxのbusinessAddress.cityがバンドルによって自動的に処理されるかどうかを知るいけないか私を行い、
$boolQuery = new BoolQuery();
$cityQuery = new Match();
$cityQuery->setFieldQuery('businessAddress.city', array($city]));
$cityQuery->setFieldParam('businessAddress.city', 'analyzer', 'custom_analyzer');
$boolQuery->addMust($cityQuery);
$this->finder->find($boolQuery);
JSONクエリ
{"query":{"bool":{"must":[{"match":{"businessAddress.city":{"query":["NY"],"analyzer":"custom_analyzer"}}}]}}}
としてしかし、0の結果を持っている:
私はこのクエリを持っていますネストされたクエリを作成する必要があります。場合は、ネストされたクエリは、私はそれを構築することができますか? JSONクエリに得
$cityQuery->setFieldQuery('businessAddress.city', array($city]));
$cityQuery->setFieldQuery('businessAddress.city', $city]);
に:私はアレイとしてマッチ用語を設定し気付く下にいくつかのコメント後EDIT
は、今はより変化
{"query":{"bool":{"must":[{"match":{"businessAddress.state":{"query":"NY","analyzer":"custom_analyzer"}}}]}}}
私はインターネットをチェックして何も見つけませんでした。
助けてください。おかげ
'$ boolQuery'をjsonとしてエクスポートできますか? ' - > toArray()'メソッドを使うことができます。 – hkulekci
@hkulekciここでは{ "クエリ" がある:{ "BOOL":{ "必要":[{ "マッチ":{ "businessAddress.city":{ "クエリ":[ "NY"]、 "分析":」 custom_analyzer "}}}]}}} – bitgandtter
このクエリはelasticsearchでは直接動作しませんでした。 Matchクエリは、検索中の配列値をサポートしていません。あなたのクエリのエラー応答を確認できますか? Elasticaはエラーを返しましたか? – hkulekci