Try with high lowercase or use a match query which is analyzed.

--
David ;-)
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs


Le 5 juin 2014 à 03:49, Sunny Cal <[email protected]> a écrit :

I am running into a strange issue.
I have created a index "alerts" and putting "alert" objects in it.
When I do 
curl -XGET 'http://localhost:9200/twitter/_search?q=severity:HIGH'
I get the alert objects as output.
I also get correct results when I go to HEAD and execute the query 
{"query":{"term":{"severity":"HIGH"}}}

The results are like:
{"_index":"alerts","_type":"alert","_id":"_zR5BTp7QLCpt0Dh2-7cxA","_score":1.7461716,"_source":{"alertId":3,"alertName":"text
 3","createdOn":1401930512641,"severity":"HIGH"}}


But when I use java to connect and get the results I get no results

Code is:
Node node = nodeBuilder().clusterName("elasticsearch").node();
Client client = node.client();
SearchRequestBuilder srb = client
        .prepareSearch("alerts")
        .setTypes("alert")
        .setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
        .setQuery(QueryBuilders.termQuery("severity", "HIGH")) ;
System.out.println("Sending:" + srb.toString());
SearchResponse response = srb.execute().actionGet();
System.out.println("Searched");
System.out.println("GOT ROWS:" + response.toString());


Output is:

Sending:{
  "query" : {
    "term" : {
      "severity" : "HIGH"
    }
  }
}
Searched
GOT ROWS:{
  "took" : 50,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 0,
    "max_score" : null,
    "hits" : [ ]
  }
}


Can anybody help.. I have tried a lot of things but it is not working.
I am using jdk1.7.0_40.. if that makes any difference

Thanks
C
-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/7f15b62d-951e-48af-9acc-e9b4b10149e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/21B22A69-AFF3-46FC-867E-F836F4E1751D%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

Reply via email to