Hello, How to convert this Query Sql with java High Level Rest Client
// select count(*) from Customer group by Last_Name, First_Name, City
Thank you in advance
Hello, How to convert this Query Sql with java High Level Rest Client
// select count(*) from Customer group by Last_Name, First_Name, City
Thank you in advance
Welcome!
select count(*) from Customer group by Last_Name, First_Name, City
Is most likely the same as
select count(*) from Customer
Is that what you want?
But anyway my advice would be first to write the elasticsearch query.
You can get it by using the translate API like:
DELETE customer
PUT customer
{
"mappings": {
"properties": {
"City": { "type": "keyword" },
"First_Name": { "type": "keyword" },
"Last_Name": { "type": "keyword" }
}
}
}
POST customer/_doc
{
"Last_Name": "foo",
"First_Name": "bar",
"City": "somewhere"
}
POST _sql/translate
{
"query": "select count(*) from customer"
}
POST _sql/translate
{
"query": "select count(*) from customer group by Last_Name, First_Name, City"
}
Then adapt the result to the java High Level Rest Client.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.