Different results in direct query and template, based on it

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Different results in direct query and template, based on it

phyx00
This post has NOT been accepted by the mailing list yet.
Greetings.

We are using elastic for a finding similar docs by "more_like_this" function. And it worked just fine.
Couple weeks ago, web-dev guys decided to implement search template instead of using direct query. Can't blame em, less code, easy parameterising.

For 99% of searches it worked quite well.

But for several of them - results are completely different from results of this query, executed in Sense, with parameters filled in with values.

Exact same query,

executed like

POST /products/nms/_search
{
"query": {
      "filtered": {
         "query": {
            "bool": {
               "must": [
                  {
                     "match_all": {}
                  }
               ],
               "should": [
                  {
                     "more_like_this": {
                        "fields": [....],
                        "docs": [                           {
                              "_index": "...",
                              "_type": ".....",
                              "_id": 2171235
                           }
                        ]
...and so on...
}

and executed like

PUT /_search/template/test_template
{
   "template": {
      "query": {
         "bool": {
            "should": [
               {
                  "filtered": {
                     "query": {
                        "bool": {
                           "must": [
                              {
                                 "more_like_this": {
                                    "fields": [....],
                                    "docs": [
                                       {
                                          "_index": "....",
                                          "_type": "....",
                                          "_id": "{{nm_id}}"
                                       }
....

and

POST index/type/_search/template
{
   "template": {
      "id": "test_template"
   },
      "params": {
         "nm_id": 2325491
      }
   }
}



And we get different sets of docs, completely different .

Any clue wat it can be?

Thanks,
Michael