elasticsql icon indicating copy to clipboard operation
elasticsql copied to clipboard

convert error : nend convert select sql fields to json fields like `"_source":["title", "price"]`

Open gudigudi opened this issue 5 years ago • 2 comments

original SQL :

select title, price from products where title = '%A%'

expect like that :

{
    "_source": [
        "title",
        "price",
    ],
    "query": {
        "bool": {
            "must": [
                {
                    "match_phrase": {
                        "title": {
                            "query": "%A%"
                        }
                    }
                }
            ]
        }
    },
    "from": 0,
    "size": 1
} 

actually, elasticsql.Convert(sql) didn't generate "_source":["title", "price"]

gudigudi avatar Aug 30 '20 16:08 gudigudi

@gudigudi ,想不起来这个当时为啥没支持了。。会有啥影响么

cch123 avatar Sep 07 '20 03:09 cch123

sql支持只select特定字段,es的查询也支持。实际使用中有这类需求的。

gudigudi avatar Sep 18 '20 05:09 gudigudi