Я получаю эту ошибку [parsing_exception] [multi_match] искаженный запрос в то время как массовый поиск в базе данных ElasticSearch. Я не нашел ошибок на объекте JSON. запрос на is_processed ": false Записи, содержащие name1 это поля [" NAME "," NICKNAME "] или Записи, содержащие name2 это поля [" NAME "," NICKNAME "]
условие: is_processed ": false И (name1 ИЛИ name2 в [" NAME "," NICKNAME "])
import * as elasticsearch from "elasticsearch";
const elasticClient = new elasticsearch.Client({
host: process.env.ELASTIC_HOST,
log: 'error'
})
elasticClient.msearch({
index: indexName,
type: docType,
body: payload
})
I отправляю эту полезную нагрузку для поиска
payload = '
{}
{
"query": {
"bool": {
"must": [
{ "match": { "is_processed": false } },
{
"bool": {
"should":[
{
"multi_match": {
"query": name1,
"type": "cross_fields",
"fields": ["NAME", "NICKNAME"],
"minimum_should_match": "100%"
}
},
{
"multi_match": {
"query": name2,
"type": "cross_fields",
"fields": ["NAME", "NICKNAME"],
"minimum_should_match": "100%"
}
}
]
}
}
]
}
}
}'
Ошибка:
body:Object {error: Object, status: 400}
displayName:"BadRequest"
message:"[parsing_exception] [multi_match] malformed query, expected [END_OBJECT] but found [FIELD_NAME], with { line=1 & col=121 }"
path:"/user/_msearch"
query:Object {type: "user"}
response:"{"error":{"root_cause":[{"type":"parsing_exception","reason":"[multi_match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":1,"col":121}],"type":"parsing_exception","reason":"[multi_match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":1,"col":121},"status":400}"
stack:"Error: [parsing_exception] [multi_match] malformed query, expected [END_OBJECT] but found [FIELD_NAME], with { line=1 & col=121 }
at respond (/Users/apple/Desktop/Development/aml/node_modules/elasticsearch/src/lib/transport.js:349:15)