我在ElasticSearch中有以下JSON对象as _source。我需要根据条件筛选源对象。例如,我只需要具有applied_as ==“COMMISSION”的JSON
"_source": {
"factor" : [
{
"some_amount_usd" : [
{
"applied_as" : "TCKT_CNT",
"version" : "8",
"factor_value" : "1.12",
"start_date" : "2022-01-01"
},
{
"applied_as" : "TCKT_CNT",
"version" : "8",
"factor_value" : "1.12",
"start_date" : "2022-02-01"
},
{
"applied_as" : "COMMISSION",
"version" : "8",
"factor_value" : "1.12",
"start_date" : "2022-02-01"
},
]
}
]
}
我正在使用此文档。https://www.elastic.co/guide/en/elasticsearch/reference/7.17/search-fields.html#source-filtering
我当前正在使用此查询,但没有成功。我错过了什么?
GET form_some_index/_search
{
"query": {
"match": {
"factor.some_amount_usd.applied_as": "COMMISSION"
}
}
}
2条答案
按热度按时间bcs8qyzn1#
你可以像这样执行查询,但是这将返回整个factor obj
有关详细信息,请参阅official document
daolsyd02#
您可以开始使用Nested Query。