1

这是我的查询模板,它是小胡子-

{\"query\":{\"ids\":{\"type\":\"component\",\"values\":[{{#id_list1}}{{value}}{{#comma}},{{/comma}}{{/id_list1}}]}},\"size\":{{#size}}{{size}}{{/size}}{{^size}}200{{/size}}}{{/id_list}}

在我传递诸如“1110,1111,1123”甚至“1110”之类的值时,它工作正常,但是当我尝试传递诸如“1110_media”之类的值时,它给了我一个错误,

"type": "parsing_exception",
        "reason": "[ids] failed to parse field [values]",
        "line": 1,
        "col": 47,
        "caused_by": {
            "type": "json_parse_exception",
            "reason": "Unexpected character ('_' (code 95)): was expecting comma to separate Array entries\n at [Source: {\"query\":{\"ids\":{\"type\":\"component\",\"values\":[1110_media]}},\"size\":200}; line: 1, column: 52]"
        }
    }, 

当我尝试不使用模板进行搜索时,它给了我想要的结果,例如 -

{"query":{"ids":{"type":"component","values":["1110_media","1110"]}},"size":200}

我们如何转义具有下划线的数组值?

4

0 回答 0