AndyB
Well-known member
I have an add-on called Similar Threads Plus which displays similar threads based on thread title matches.
The following query works fine in ElasticSearch 5.0:
The results are 5 thread IDs.
The query sort of works in ElasticSearch 6.0, but instead of getting 5 threads that match, I'm now getting a mixture of threads and posts. The results array looks like this:
How should I change the query so that only threads are searched?
The following query works fine in ElasticSearch 5.0:
PHP:
$data_string = '{
"from" : 0, "size" : "' . $maximumResults . '",
"query" : {
"bool" : {
"must" : {
"match" : {
"title" : {
"query" : "' . $searchWord1 . ' ' . $searchWord2 . ' ' . $searchWord3 . '",
"operator" : "and"
}
}
},
"filter" : {
"bool" : {
"must" : [
{
"term" : {
"node" : "' . $currentNodeId . '"
}
}
],
"must_not" : {
"term" : {
"discussion_id" : "' . $currentThreadId . '"
}
}
}
}
}
},
"sort": {
"date": {"order": "desc" }
}
}';
The results are 5 thread IDs.
The query sort of works in ElasticSearch 6.0, but instead of getting 5 threads that match, I'm now getting a mixture of threads and posts. The results array looks like this:
PHP:
Array
(
[0] => post-2153581
[1] => thread-157934
[2] => thread-157860
[3] => post-2152604
[4] => thread-157727
)
How should I change the query so that only threads are searched?