当前位置: 首页 > 工具软件 > Object Query > 使用案例 >

[range] malformed query, expected [END_OBJECT] but found [FIELD_NAME]

匡凌
2023-12-01

在ES中,查询条件为

{
    "query": {
        "match": {
            "yqxs": 1
        },
        "range": {
            "id": {
                "gte": 3000000000,
                "lte": 4000000000
            }
        }
    },
    "size": 1
}

报错:[match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]
畸形的查询,期望结束,但是找到了字段

{
    "query": {
        "bool": {
            "must": [
                {
                    "match": {
                        "yqxs": 1
                    }
                },
                {
                    "range": {
                        "id": {
                            "gte": 3000000000,
                            "lte": 4000000000
                        }
                    }
                }
            ]
        }
    },
    "size": 1
}

1.使用bool的must做联合查询,must中接收数组,放我们的两个查询条件

 类似资料: