OpenSearch 文档表示
fetch_size
受支持并且应该可以工作。然而,这在 OpenSearch 2.5.3 中绝对不适合我。
查询1:
POST _plugins/_sql/
{
"query" : "SELECT start_time FROM my_opensearch_index"
}
回复1:
{
"schema": [
{
"name": "start_time",
"type": "timestamp"
}
],
"datarows": [
[
"2022-12-01 02:46:18.406516529"
],
[
"2022-12-01 02:46:15.83386667"
],
...
],
[
"2022-12-01 02:57:49.658765135"
]
],
"total": 200,
"size": 200,
"status": 200
}
200
似乎是 size
查询的默认 SQL
。但是,当我尝试这个查询时:
查询2:
POST _plugins/_sql/
{
"fetch_size" : 5,
"query" : "SELECT start_time FROM my_opensearch_index"
}
回复2:
{
"error": {
"reason": "There was internal problem at backend",
"details": "Index type [my_opensearch_index] does not exist",
"type": "IllegalArgumentException"
},
"status": 500
}
请注意,
Query 2
中唯一发生的变化是在查询中添加了 "fetch_size" : 5,
。
注意:这是在 OpenSearch 2.5.3 上完成的;我还没有在 ElasticSearch 上尝试过这个,我知道他们有类似的功能。
它适用于 csv 和 json 格式,因为我在 aws open search 上运行它 终点
POST https://..../_plugins/_sql?format=csv' 或 _plugins/_sql?format=json
'{
"fetch_size":500,
"query": "SELECT some FROM other LIMIT 500"
}'