iamazy / elasticsearch-sql

parse sql into elasticsearch dsl with antlr4
https://iamazy.github.io/elasticsearch-sql/
MIT License
339 stars 89 forks source link

希望后续能支持UPDATE、DELETE等sql,最好建表SQL也能支持 #47

Open otary opened 3 years ago

otary commented 3 years ago

如题,希望后续能支持UPDATE、DELETE等sql,最好建表SQL也能支持

iamazy commented 3 years ago

如题,希望后续能支持UPDATE、DELETE等sql,最好建表SQL也能支持

Update, Delete 都有,create 目前没有,有时间我加下。

@otary,如果你愿意,欢迎提pr

otary commented 3 years ago

试了下,UPDATE语句解析报错:[syntax error] indices name must be set

iamazy commented 3 years ago

试了下,UPDATE语句解析报错:[syntax error] indices name must be set

发下语句

otary commented 3 years ago
UPDATE users set age = 10 where id =1 

实际上,任何UPDATE语句都会报错~!

iamazy commented 3 years ago

UPDATE users set age = 10 where id =1

@otary 你是这么获取的吗?parseResult.getUpdateByQueryRequest()

otary commented 2 years ago

ElasticSql2DslParser elasticSql2DslParser = new ElasticSql2DslParser(); ElasticSqlParseResult result = elasticSql2DslParser.parse("UPDATE users set age = 10 where id =1");

result.getUpdateByQueryRequest(); // 返回内容update-by-query [users] updated with Script{type=inline, lang='painless', idOrCode='ctx._source.age=10;', options={}, params={}} result.getSearchRequest(); // 报错:[syntax error] indices name must be set

我想获取update的dsl,不知道要怎么获取呢?求指教