Php query issue with elasticsearch

Hello everyone,

I need some help for a query, there is my query and i will explain my issues below (i work in PHP):

$client = ClientBuilder::create()->build();

$params = [
    'index' => 'formations',
    'type' => 'form',
    "from" => 0, "size" => 40,
    "body" => [
        "query" => [
            "bool" => [
                "should" => [
                    "multi_match" => [
                        "type" => "cross_fields",
                        "fields" => ["name", "cities", "sessions"],
                        "query" => '*'.$request->research.'*',
                        "operator" => "OR",
                        "boost" => 3
                    ]
                ]
            ]
        ],
        "highlight" =>[
            "pre_tags" => ['<strong class="text-primary">'],
            "post_tags" => ['</strong>'],
            'fields' => [
                'villes' => new \stdClass(),
            ],
        ]
    ]
];

$response = $client->search($params);

When i type the words like 'computer washington', the first result will be those with the empty cities array( the records contains both the word computer and only one contains washington and the other nothing).
My second issue is to make partial mathing, if i type "informatique" or "l'informatique" it will match both.

i tried to do "query" => " * ".$request->research." * " but its not working :confused:

if someone can help me !
Thanks a lot
Alex

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.