Getting specific Fields

2014-01-02 Thread paul
My DATA
---
{
   rankingList:[
  {
 value:9,
 key:Academic
  },
  {
 value:6,
 key:Flexibility
  }
   ]
}

{
   rankingList:[
  {
 value:12,
 key:Academic
  },
  {
 value:6,
 key:Flexibility
  }
   ]
}

My Mapping
---
{
   mappings:{
  TestNested:{
 properties:{
rankingList:{
   type:nested
}
 }
  }
   }
}

My QUERY
-
{
  query: {
nested: {
  path: rankingList,
  query: {
bool: {
  must: [
{
  match: {
rankingList.key: {
  query: Academic
}
  }
},
{
  range: {
rankingList.value: {
  gt: 5
}
  }
}
  ]
} 
  }
}
  }
}

I want to get only the key value that is related to Academic within the 
array is it possible. right now query works fine but returns all the array 
elements.

- Paul

-- 
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/6f5c2cd1-a92e-4c8c-8bd3-ca8193033080%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Getting specific Fields

2014-01-02 Thread Ivan Brusic
Not yet supported:
https://github.com/elasticsearch/elasticsearch/issues/3022

Cheers,

Ivan


On Thu, Jan 2, 2014 at 4:27 AM, paul avinashpau...@gmail.com wrote:

 My DATA
 ---
 {
rankingList:[
   {
  value:9,
  key:Academic
   },
   {
  value:6,
  key:Flexibility
   }
]
 }

 {
rankingList:[
   {
  value:12,
  key:Academic
   },
   {
  value:6,
  key:Flexibility
   }
]
 }

 My Mapping
 ---
 {
mappings:{
   TestNested:{
  properties:{
 rankingList:{
type:nested
 }
  }
   }
}
 }

 My QUERY
 -
 {
   query: {
 nested: {
   path: rankingList,
   query: {
 bool: {
   must: [
 {
   match: {
 rankingList.key: {
   query: Academic
 }
   }
 },
 {
   range: {
 rankingList.value: {
   gt: 5
 }
   }
 }
   ]
 }
   }
 }
   }
 }

 I want to get only the key value that is related to Academic within the
 array is it possible. right now query works fine but returns all the array
 elements.

 - Paul

 --
 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/6f5c2cd1-a92e-4c8c-8bd3-ca8193033080%40googlegroups.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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDqTQy6iVe_%3DgSQowUE-Gh5Ug%2Bn2b_Jn2CsDeRN3GwGKA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.