I would like to set the search_type with the PHP SDK of Elasticsearch.
At the moment my params looks like this:
$params = [
"from" => 0
"size" => 20
"_source" => [...]
"body" => [
"query" => [
"bool" => [
"must" => [
"multi_match" => [
"query" => "searchTerm"
"fields" => [...]
"operator" => "and"
"type" => "cross_fields"
]
]
]
]
]
];
According to this issue https://github.com/elastic/elasticsearch-php/issues/121 I simply have to add the search_type to $params
$params['search_type'] = 'dfs_query_then_fetch';
Also I tried to add it to the body
$params['body']['search_type'] = 'dfs_query_then_fetch';
Both options are invalid and return a BadRequest400Exception
.
According to the repository, it is possible to add the parameter. https://github.com/elastic/elasticsearch-php/blob/master/src/Elasticsearch/Client.php#L915
Here it says enum
as data type.
What exactly is enum
in PHP? And what is it in this particular situation?
Does anyone have an example for me, how to add the search_type correct?
Thanks in advance.