[英]How to add multiple fields to a common terms query in ElasticSearch?
我有一個像這樣的共同術語查詢。
{
"query" : {
"common" : {
"DocumentData.OCR_Text" : {
"query" : "block 310 luis",
"cutoff_frequency" : 0.001
}
}
}
}
我想搜索2個或更多字段,但這給了我一個錯誤。
{
"query" : {
"common" : {
"Grantors" : {
"query" : "block 310 luis",
"cutoff_frequency" : 0.001
},
"DocumentData.OCR_Text" : {
"query" : "block 310 luis",
"cutoff_frequency" : 0.001
}
}
}
}
嵌套:ElasticsearchParseException [預期字段名稱但得到START_OBJECT“DocumentData.OCR_Text”];
你會怎么做?
您應該將其包裝在Bool查詢中
{
"query": {
"bool": {
"should": [
{
"common": {
"Grantors": {
"query": "block 310 luis",
"cutoff_frequency": 0.001
}
}
},
{
"common": {
"DocumentData.OCR_Text": {
"query": "block 310 luis",
"cutoff_frequency": 0.001
}
}
}
]
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.