我正在使用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
}
我在文档中读过:
保留字符编辑如果您需要使用任何字符 在查询本身中作为运算符运行(而不是作为运算符), 然后你应该用一个反斜杠来逃避它们。例如,到 搜索(1 + 1)= 2,您需要将查询编写为(1 + 1)\ = 2.
但我已经逃脱了所有这些特殊字符.. 如果我删除上面提到的那些2比我有相同的结果(文件,得分等)。 谢谢你的帮助!