Re: A simple example of how to use the Java API?

2015-03-27 Thread Mark Warner
Here is how you do it..

QueryBuilder qb = QueryBuilders
.boolQuery()
.must(QueryBuilders.termQuery("roomid","7087") )
.must(QueryBuilders.termQuery("sessionid","55622"));


On Wednesday, November 14, 2012 at 10:04:41 PM UTC-5, Ryan Compton wrote:
>
> I am completely new to Elastic Search. I have figured out enough that I 
> can retrieve jsons from our cluster with:
>
> -bash-3.2$ curl -XGET http://10.10.1.7:9200/twitter-sept/_search -d 
> '{"query":{"bool":{"must":[{"term":{"tweet":"elastic"}}],"must_not":[],"should":[]}},"from":0,"size":50,"sort":[],"facets":{}}'
>
> Since most of my code is in Java I figured things would be easier if I 
> used the Java API. I am completely stumped on how to do it. The guide 
> http://www.elasticsearch.org/guide/reference/java-api/search.html is 
> confusing. What are all those classes? Where are the javadocs? Is there a 
> simple example somewhere that explains how I can reproduce the above 
> command in Java? Do I need a TransportClient, a SearchSourceBuilder, 
> ImmutableSettings?
>

-- 
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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/84c0ad1c-7242-49ae-ac2b-3f9ea0d0a619%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A simple example of how to use the Java API?

2015-03-27 Thread Mark Warner

So where is a good java example showing how to use the java api to do a 
simple and condition. I can get this to work work fine with curl but how do 
I use the java api to implement it.

curl -XPOST 10.20.71.30:9200/sessionmsg/_search?pretty -d  '{
  "query": {
"bool": {
  "must": [
{
  "term": {
"roomid": "7087"
  }
},
{
  "term": {
"sessionid": "55622"
  }
}
  ]
  }
}
  }
}'

how can I implement the above with this kind of call?
SearchResponse response = client.prepareSearch("sessionmsg")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(QueryBuilders.termQuery("roomid", "7087"))
.setFrom(0).setSize(60).setExplain(true).execute().actionGet();


On Tuesday, March 24, 2015 at 8:05:57 AM UTC-4, David Pilato wrote:
>
> Did you look at answer branch?
>
> Answers are on answers branch: 
>> https://github.com/elasticsearchfr/hands-on/tree/answers
>>
>
>
> David
>
> Le 24 mars 2015 à 12:58, 'newbo' via elasticsearch <
> elasti...@googlegroups.com > a écrit :
>
> Hey David,
>
> I'm looking at the code now and I see lots of TODOs and nulls, but no 
> actual indexing.  Perhaps that code needs to be cleaned up?
>
> On Thursday, November 15, 2012 at 9:11:02 AM UTC-5, David Pilato wrote:
>>
>>
>> Hi Ryan,
>>
>> Have a look at this: https://github.com/elasticsearchfr/hands-on
>> Answers are on answers branch: 
>> https://github.com/elasticsearchfr/hands-on/tree/answers
>>
>> Some slides (in french but you can understand code) are here: 
>> http://www.slideshare.net/mobile/dadoonet/hands-on-lab-elasticsearch
>>
>> I'm waiting for ES team to merge my Java tutorial: 
>> https://github.com/elasticsearch/elasticsearch.github.com/pull/321
>> It will look like this: 
>> https://github.com/dadoonet/elasticsearch.github.com/blob/9f6dae922247a81f1c72c77769d1dce3ad09dca5/tutorials/_posts/2012-11-07-using-java-api-basics.markdown
>>
>>
>> HTH
>>
>> --
>> David ;-)
>> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
>>
>>  -- 
> 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 elasticsearc...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elasticsearch/92c7a0f5-ef47-45c2-b121-8c0302fa8c71%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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/6541b592-3e0f-4d6e-8ae3-6e37595d3ee2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A simple example of how to use the Java API?

2015-03-24 Thread David Pilato
Did you look at answer branch?

>> Answers are on answers branch: 
>> https://github.com/elasticsearchfr/hands-on/tree/answers
>> 



David

> Le 24 mars 2015 à 12:58, 'newbo' via elasticsearch 
>  a écrit :
> 
> Hey David,
> 
> I'm looking at the code now and I see lots of TODOs and nulls, but no actual 
> indexing.  Perhaps that code needs to be cleaned up?
> 
>> On Thursday, November 15, 2012 at 9:11:02 AM UTC-5, David Pilato wrote:
>> 
>> Hi Ryan,
>> 
>> Have a look at this: https://github.com/elasticsearchfr/hands-on
>> Answers are on answers branch: 
>> https://github.com/elasticsearchfr/hands-on/tree/answers
>> 
>> Some slides (in french but you can understand code) are here: 
>> http://www.slideshare.net/mobile/dadoonet/hands-on-lab-elasticsearch
>> 
>> I'm waiting for ES team to merge my Java tutorial: 
>> https://github.com/elasticsearch/elasticsearch.github.com/pull/321
>> It will look like this: 
>> https://github.com/dadoonet/elasticsearch.github.com/blob/9f6dae922247a81f1c72c77769d1dce3ad09dca5/tutorials/_posts/2012-11-07-using-java-api-basics.markdown
>> 
>> 
>> HTH
>> 
>> --
>> David ;-)
>> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> -- 
> 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 elasticsearch+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elasticsearch/92c7a0f5-ef47-45c2-b121-8c0302fa8c71%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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/F32F4B0D-3A65-45C6-BC95-19608C8AE62B%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.


Re: A simple example of how to use the Java API?

2015-03-24 Thread 'newbo' via elasticsearch
Hey David,

I'm looking at the code now and I see lots of TODOs and nulls, but no 
actual indexing.  Perhaps that code needs to be cleaned up?

On Thursday, November 15, 2012 at 9:11:02 AM UTC-5, David Pilato wrote:
>
>
> Hi Ryan,
>
> Have a look at this: https://github.com/elasticsearchfr/hands-on
> Answers are on answers branch: 
> https://github.com/elasticsearchfr/hands-on/tree/answers
>
> Some slides (in french but you can understand code) are here: 
> http://www.slideshare.net/mobile/dadoonet/hands-on-lab-elasticsearch
>
> I'm waiting for ES team to merge my Java tutorial: 
> https://github.com/elasticsearch/elasticsearch.github.com/pull/321
> It will look like this: 
> https://github.com/dadoonet/elasticsearch.github.com/blob/9f6dae922247a81f1c72c77769d1dce3ad09dca5/tutorials/_posts/2012-11-07-using-java-api-basics.markdown
>
>
> HTH
>
> --
> David ;-)
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
>
>

-- 
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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/92c7a0f5-ef47-45c2-b121-8c0302fa8c71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.