Dies ist meine Abfrage in symfony2. Ich möchte hier "match_phrase" hinzufügen, aber überall, dass ich hinzufügen, erhalte ich Fehler.Wie match_phrase mit constant_score zu verwenden ist, Begriffe
$params = [
'index' => 'articles_v2',
'type' => 'article',
'body' => [
"sort" => [
[ "date" =>
["order" => "desc"]
],
],
"from" => $fromId,
"size" => $newsPerPage,
"query" => [
"constant_score" => [
"filter" => [
"bool" => [
"must" => [
["terms" => [ "article.topics" => $topics ] ],
["match_phrase" => ["article.bodytext" => [$search_phrase] ]]
]
]
]
]
]
]
];
$response = $client->search($params);
Wenn ich versuche, dies zu laufen, bekomme ich Fehler: verschachtelte: QueryParsingException [[articles_v2] Kein Filter registriert für [match_phrase]]; }]“, "Status":. 400
Also, wo diese match_phrase platzieren (Ich will Ergebnisse wie SQL LIKE '% xxxx%' erhalten)
ich die Abfrage geändert haben diese Zeit keine Fehler, aber wie auch immer, keine Filtration.
$params = [
'index' => 'articles_v2',
'type' => 'article',
'body' => [
"sort" => [
[ "date" =>
["order" => "desc"]
],
],
"from" => $fromId,
"size" => $newsPerPage,
"query" => [
"constant_score" => [
"filter" => [
"bool" => [
"must" => [
["terms" => [ "article.topics" => $topics ] ]
]
]
],
"query" => [
"multi_match" => [
"query" => $search_phrase,
"fields" => [ "title", "bodytext" ]
]
]
]
]
]
];
$response = $client->search($params);