Elastica
Elastica copied to clipboard
Setting option in Search.php is ignored
I create a test search to inspect a problem and setting a search with this option :
$index->search($query, ['search_type' => 'dfs_query_then_fetch']);
the query with curl set in verbose mode shows it correctly in the query string
/elastica_elasticatestqueryboostingtestdeebfa/_search?search_type=dfs_query_then_fetch
but ES logs shows this
search_type[QUERY_THEN_FETCH]
instead of search_type[DFS_QUERY_THEN_FETCH],
We should inspect if it's a bug of Elastica or of the es-php client
Did you try to run the query manually against ES and check what the log output is?
yes if I execute the query with a curl
curl -XGET 'elasticsearch:9200/fedetest/_search?pretty=true&search_type=dfs_query_then_fetch' -H 'Content-Type: application/json' -d'
{
"query": {
"boosting" : {
"positive" : {
"term" : {
"name" : "vital"
}
},
"negative" : {
"term" : {
"name" : "mercury"
}
},
"negative_boost" : 0.2
}
}
}
'
enabling logs on ES returns search_type[DFS_QUERY_THEN_FETCH]
executing a search in Elastica like this one
$response = $this->_getTestIndex()->search($query, ['search_type' => 'dfs_query_then_fetch' ]);
ES output log is
search_type[QUERY_THEN_FETCH]
and if I try to debug the HTTP Transport (enabling VERBOSE on CURL) the querystring is correctly formatted :
/elastica_elasticatestqueryboostingtestdeebfa/_search?search_type=dfs_query_then_fetch
So there's something that not send this option... maybe es-php client but I'm not sure, I've created an issue 'cause this is not something directly related to allow Elastica working with ES6. I will try to inspect later maybe if u have some ideas...
Thanks for all the details. Will let you know if I find time to also dig into this.