ES разные результаты запроса против query_string - PullRequest
0 голосов
/ 17 мая 2018

У меня запрос с использованием query_string:

{
  "query": {
    "bool": {
      "should": [
        {
          "query_string": {
            "query": "((test_pc)^3.1604938271604937 OR (test_incoporated)^2.7777777777777772 OR (ttst)^2.0408163265306123 OR (test_inc)^3.792243767313019 OR (blue_meanies_\\(test\\))^1.7777777777777777 OR (test_smth_co.)^2.4693877551020407 OR (test_incorporate)^2.7777777777777772 OR (qwe_inc.)^2.640625 OR (test,_inc.)^3.8117913832199544 OR (testinc)^3.567901234567901 OR (test_inc.)^4.0) AND ((reblahed)^3.0625 OR (list_of_blah_philosophies)^1.8595041322314052 OR (content_blah)^2.5600000000000005 OR (blahed)^3.4489795918367347 OR (basic_blah)^2.7777777777777772 OR (blah_philosophy)^2.3156899810964084 OR (deisgn)^3.3611111111111116 OR (blahs)^3.698224852071006 OR (reblah)^3.4489795918367347 OR (blah_process)^2.5600000000000005 OR (blah)^4.0)",
            "default_field": "text"
          }
        }
      ]
    }
  },
  "timeout": "5s",
  "terminate_after": 250
}

от Ive отлажено из-за этих двух:

(blue_meanies_(test))^1.7777777777777777 OR 
(test,_inc.)^3.8117913832199544 OR 

У меня разные результаты по сравнению с использованием запроса:

{
  "query": {
    "bool": {
      "must": [
        {
          "bool": {
            "minimum_should_match": 1,
            "should": [
              {
                "term": {
                  "text": {
                    "boost": 3.0625,
                    "value": "reblahed"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 1.8595041322314052,
                    "value": "list_of_blah_philosophies"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 2.5600000000000005,
                    "value": "content_blah"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 3.4489795918367347,
                    "value": "blahed"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 2.7777777777777772,
                    "value": "basic_blah"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 2.3156899810964084,
                    "value": "blah_philosophy"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 3.3611111111111116,
                    "value": "deisgn"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 3.698224852071006,
                    "value": "blahs"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 3.4489795918367347,
                    "value": "reblah"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 2.5600000000000005,
                    "value": "blah_process"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 4,
                    "value": "blah"
                  }
                }
              }
            ]
          }
        },
        {
          "bool": {
            "minimum_should_match": 1,
            "should": [
              {
                "term": {
                  "text": {
                    "boost": 3.1604938271604937,
                    "value": "test_pc"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 2.7777777777777772,
                    "value": "test_incoporated"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 2.0408163265306123,
                    "value": "ttst"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 3.792243767313019,
                    "value": "test_inc"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 1.7777777777777777,
                    "value": "blue_meanies_(test)"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 2.4693877551020407,
                    "value": "test_computer_co."
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 2.7777777777777772,
                    "value": "test_incorporate"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 2.640625,
                    "value": "qwe_inc."
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 3.8117913832199544,
                    "value": "test,_inc."
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 3.567901234567901,
                    "value": "testinc"
                  }
                }
              },
              {
                "term": {
                  "text": {
                    "boost": 4,
                    "value": "test_inc."
                  }
                }
              }
            ]
          }
        }
      ]
    }
  },
  "timeout": "5s",
  "terminate_after": 250
}

Я прочитал в документах, что:

Reserved Charactersedit Если вам нужно использовать любой из символов, которые функционировать как операторы в самом запросе (а не как операторы), тогда вы должны избежать их с ведущей обратной косой чертой. Например, чтобы Для поиска (1 + 1) = 2 вам необходимо написать запрос как (1 + 1) \ = 2.

но я избежал всех этих специальных символов .. Если я уберу упомянутые выше 2, то получу точно такие же результаты (документы, оценки и т. Д.) Спасибо за помощь!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...