You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by AshwinKumar AshwinKumar <aa...@g.clemson.edu> on 2017/10/05 20:37:36 UTC

querying elastisearch fields

Hi devs,

I have created an index called Movies and a type called Movie inside it.
Below is the structure -

curl -XPUT "http://localhost:9200/movies/MOVIE/1" -d'
{
    "MID" : "1",
    "TITLE": "The Godfather",
    "DIRECTOR": "Francis Ford Coppola",
    "YEAR": 1972
}'




sqlline> !connect
jdbc:calcite:model=./cassandra/src/test/resources/modelPost.json admin admin
2017-10-05 21:31:28,668 [main] INFO  - [Dum-Dum Dugan] modules [], plugins
[], sites []
0: jdbc:calcite:model=./cassandra/src/test/re> select * from
"elasticsearch".movie;
+------+
| _MAP |
+------+
| {YEAR=1972, MID=1, TITLE=The Godfather, DIRECTOR=Francis Ford Coppola} |
+------+
1 row selected (2.057 seconds)
0: jdbc:calcite:model=./cassandra/src/test/re>



Now If I want to query a specific field inside the map , what should the
query look like . I am able to retrieve all the information by the query -

select * from "elalsticsearch".movie;

"elasticsearch" = schema
"movie" = type

Now If I want to query only the title name from the type, Could you please
let me know the syntax.

Thanks,
Ashwin

Re: Re: Assunto: querying elastisearch fields

Posted by Luis Fernando Kauer <lf...@yahoo.com.br.INVALID>.

  Your problem, again, is about the names being case sensitive. 
Try using double quotes around column and table names to make sure they are interpreted correctly or use them all in uppercase, both in the json model and in the query. 
You can also set a different lex property for the connection that is more flexible like MYSQL_ANSI or just the caseSensitive property to false. 
http://calcite.apache.org/docs/adapter.htm

Assunto: querying elastisearch fields

Posted by Luis Fernando Kauer <lf...@yahoo.com.br.INVALID>.
Did you take a look in the test cases for some examples of use? 
https://github.com/apache/calcite/blob/master/elasticsearch5/src/test/java/org/apache/calcite/test/Elasticsearch5AdapterIT.java
What have you tried?