Api php elasticsearch

HI

After migrating my scripts from Es 2.4 to 6.2.1, i removed multi types as specified in the documentation;

I had before 5 types, and now in my script php, how i can search by dropdown list (per types) ??????
I struggled several days...

this is my code:

//$this->client = Elasticsearch\ClientBuilder::create()->build();
$clientBuilder = ClientBuilder::create(); // Instantiate a new ClientBuilder
$clientBuilder->setHosts($hosts); // Set the hosts
$client = $clientBuilder->build();
$this->index = $index;
$this->type = $type;
$this->fuzzy = $fuzziness;

    } catch (Exception $e) {

        echo 'Exception received : ',  $e->getMessage(), "\n";
	}

}

function search($query) {

	$params = [
	    'index' => $this->index,
	    'type' => $this->type,
	    'size' => 10000   ];

	$params['body']['query']['multi_match']['query'] = $query;
	$params['body']['query']['multi_match']['fields'] = ['_all'];
	$params['body']['query']['multi_match']['fuzziness'] = $this->fuzzy;
	$params['body']['query']['multi_match']['analyzer'] = "standard";
	$result = $this->client->search($params);
	$hit = $result['hits']['hits'];
	
	return $hit;
}

function getTypes() {

	$params['index'] = $this->index;

return $this->client->indices()->getMapping();
//return $this->client->indices()->getMapping($params);
}

function getIndexes() {

	return $this->client->indices()->getMapping();
}

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