Elasticsearch query array

Hello

i have this JSON structure

{
"id" : "2001",
"promptViews" : [ {
"id" : "2780",
"itemType" : "promptView"...

And im trying to query it like this...

FilterBuilder filter =FilterBuilders.boolFilter()
.must(FilterBuilders.termFilter("id", "2001"))
.should(FilterBuilders.termFilter("promptViews.id", "2780"));

final SearchResponse response =
client.prepareSearch("sfw1685asm28").setTypes("prompt").setFilter(filter)
.execute().actionGet();

but its giving me all the promptViews in the array. not just the one i
specified in the filter (2780)

Any help is appreciated

Thank you

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

You are searching for documents, generally speaking.
When your document contain a value you search for, your document is sent back exactly as you indexed it.
Whatever the structure of the document.

If you want to search for some parts of your array, index them as documents.

Does it make sense?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 18 févr. 2013 à 18:19, eric sanford pcstechnologiesinc@gmail.com a écrit :

Hello

i have this JSON structure

{
"id" : "2001",
"promptViews" : [ {
"id" : "2780",
"itemType" : "promptView"...

And im trying to query it like this...

  FilterBuilder filter =FilterBuilders.boolFilter()
  .must(FilterBuilders.termFilter("id", "2001"))	    	  
  .should(FilterBuilders.termFilter("promptViews.id", "2780"));

  final SearchResponse response = client.prepareSearch("sfw1685asm28").setTypes("prompt").setFilter(filter) 
  		.execute().actionGet();

but its giving me all the promptViews in the array. not just the one i specified in the filter (2780)

Any help is appreciated

Thank you

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

yes..perfect sense... thank you

On Monday, February 18, 2013 11:19:56 AM UTC-6, eric sanford wrote:

Hello

i have this JSON structure

{
"id" : "2001",
"promptViews" : [ {
"id" : "2780",
"itemType" : "promptView"...

And im trying to query it like this...

FilterBuilder filter =FilterBuilders.boolFilter()
.must(FilterBuilders.termFilter("id", "2001"))
.should(FilterBuilders.termFilter("promptViews.id", "2780"));

final SearchResponse response =
client.prepareSearch("sfw1685asm28").setTypes("prompt").setFilter(filter)
.execute().actionGet();

but its giving me all the promptViews in the array. not just the one i
specified in the filter (2780)

Any help is appreciated

Thank you

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.