Getting specific Fields

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+unsubscribe@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.

Not yet supported:

Cheers,

Ivan

On Thu, Jan 2, 2014 at 4:27 AM, paul avinashpaul85@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+unsubscribe@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+unsubscribe@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.

Thank you for the quick response.

On Fri, Jan 3, 2014 at 1:00 AM, Ivan Brusic ivan@brusic.com wrote:

Not yet supported:
https://github.com/elasticsearch/elasticsearch/issues/3022

Cheers,

Ivan

On Thu, Jan 2, 2014 at 4:27 AM, paul avinashpaul85@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+unsubscribe@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 a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/t6ebGDRVR3g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@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.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAO066G38R6iHcp7VHO-9T%3DtV0QtZoCxjPmYeP1-Ps2PLUsaojQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.