Wondering if this from the Elasticsearch official doc:
{
"more_like_this" : {
"fields" : ["name.first", "tweet"],
"like" : [
{
"_index" : "marvel",
"_type" : "quotes",
"doc" : {
"name": {
"first": "Ben",
"last": "Grimm"
},
"tweet": "You got no idea what I'd... what I'd give to be invisible."
}
},
],
"min_term_freq" : 1,
"max_query_terms" : 1
}
}
is yet implemented within the latest release of Elastica? The bit I am struggling with is the "doc" section of the "like".
My code is as follow:
$moreLikeThis = (new Query\MoreLikeThis())
->setFields([
'name.first',
'tweet'
])
->setLike((new Document())
->setIndex('myIndexName')
->setType('myTypeName')
->setData([
'tweet' => 'Foo',
'name' => [
'first' => 'Bar',
'last' => 'Test'
]
])
)
->setMinTermFrequency(1)
->setMinDocFrequency(1);
But it looks like the query is not generated properly. Here is what I get when I var_dump() Request::toString():
string(398) "{"path":"myIndexName/myTypeName/_search","method":"GET","data":{"query":{"more_like_this":{"fields":["name.first","tweet"],"like":{"_id":"","_type":"myTypeName","_index":"myIndexName"},"min_term_freq":1,"min_doc_freq":1}}},"query":{"search_type":"count"},"connection":{"config":[],"host":"localhost","port":9200,"enabled":true}}"
The "doc" section if definitely missing? Am I not using it properly?