Titan 0.5.0 IndexQuery problems

101 views
Skip to first unread message

Rohit

unread,
Aug 28, 2014, 3:30:44 AM8/28/14
to aureliu...@googlegroups.com
I have indexing

        PropertyKey pkuserFullName = mgmt.makePropertyKey("userFullName").dataType(String.class).make();
        mgmt.buildIndex("indexuserFullName",Vertex.class).addKey(pkuserFullName).buildMixedIndex("search");
       
        PropertyKey pkgender = mgmt.makePropertyKey("gender").dataType(String.class).make();
        mgmt.buildIndex("indexgender",Vertex.class).addKey(pkgender).buildMixedIndex("search");


Here is index query:

Iterable<Result<Vertex>> vertices = g.indexQuery("indexuserFullName","v.userFullName:Rohit~1 and v.gender:Male").vertices();

Exception in thread "main" java.lang.IllegalArgumentException: The used key [gender] is not indexed in the targeted index [indexuserFullName]
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:120)
    at com.thinkaurelius.titan.graphdb.database.IndexSerializer.executeQuery(IndexSerializer.java:612)
    at com.thinkaurelius.titan.graphdb.query.graph.IndexQueryBuilder.execute(IndexQueryBuilder.java:176)
    at com.thinkaurelius.titan.graphdb.query.graph.IndexQueryBuilder.vertices(IndexQueryBuilder.java:195)
    at newpackage.ElasticSearch.show(ElasticSearch.java:105)
    at newpackage.ElasticSearch.main(ElasticSearch.java:157)

How should I make this kind multifield query in 0.5.0. 

Again the below indexQuery work fine:

Iterable<Result<Vertex>> vertices = g.indexQuery("indexuserFullName","v.userFullName:Rohit~1").vertices();

in the log it shows:

 Converted query string with 1 replacements: [v.userFullName:manish~1] => [cwlh:Rohit~1]

When i execute below query directly using ES client:

        SearchResponse response = client.prepareSearch("titan")
        .setTypes("vertex")
        .setQuery(QueryBuilders.queryString("cwlh:Rohit~1"))       
        .execute()
        .actionGet();       

it return 0 result why ? it is the same version of index query.

and at the end it show

93651 [elasticsearch[Merlin][generic][T#3]] INFO  org.elasticsearch.client.transport  - [Merlin] failed to get local cluster state for [Blazing Skull][TF1gTpQ9QZmqn2fHTWYagw][manish-Vostro-2520][inet[/10.253.39.25:9300]], disconnecting...
org.elasticsearch.transport.ReceiveTimeoutTransportException: [Blazing Skull][inet[/10.253.39.25:9300]][cluster/state] request_id [31] timed out after [5001ms]
    at org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:369)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)

93651 [elasticsearch[Merlin][generic][T#2]] INFO  org.elasticsearch.client.transport  - [Merlin] failed to get local cluster state for [#transport#-1][manish-Vostro-2520][inet[/127.0.0.1:9300]], disconnecting...
org.elasticsearch.transport.ReceiveTimeoutTransportException: [][inet[/127.0.0.1:9300]][cluster/state] request_id [30] timed out after [5001ms]
    at org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:369)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)

is this exception something to worry about as it show timeOutException?



Matthias Broecheler

unread,
Aug 28, 2014, 7:47:50 PM8/28/14
to aureliu...@googlegroups.com
The first query fails because you did not index gender in the same mixed index.

The second query does not return results because by default a String value is mapped to a TEXT field in elastic search which only supports contains queries. Please read the documentation on how to define a STRING mapping for equality search.


--
You received this message because you are subscribed to the Google Groups "Aurelius" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aureliusgraph...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aureliusgraphs/323a0c76-482d-4b2e-98fe-9952901e976a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Matthias Broecheler
http://www.matthiasb.com
Reply all
Reply to author
Forward
0 new messages