Problem with multiple range in nested

Hi,

I do that request :

curl -X GET
'http://78.109.90.3:9200/users/user/_search?from=0&load=&size=20&pretty' -d
'{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": [{
"nested": {
"path": "apps_events",
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": [{
"term": {
"apps_events.status": "active"
}
}, {
"or": [{
"and": [{
"range": {

"apps_events.locations.inf": {
"gte": 59850
}
}
}, {
"range": {

"apps_events.locations.sup": {
"lte": 59851
}
}
}]
}]
}]
}
}
}
}
}]
}
}
},
"size": 20,
"from": 0
}'

But it returns for example user like that :

{
"_index": "users",
"_type": "user",
"_id": "21578",
"_score": 1.0,
"_source": {
"_id": 21578,
"email": "xxx@gmail.com",
"affiliate_program_id": 1,
"affiliate_state_id": 1,
"status": "no_verify",
"apps_events": [{
"id": 159026,
"source": "bien_similaire",
"frequency": "real_time",
"status": "active",
"type": "rent",
"user_id": 21578,
"affiliate_program_id": 1,
"locations": [{
"location_id": 7521,
"inf": 17198,
"sup": 17213
}, {
"location_id": 49364,
"inf": 98942,
"sup": 98943
}],
"property_classes": ["appartment", "house", "appartment",
"various"],
"price_min": "0",
"price_max": "1000"
}, {
"id": 99662,
"source": "bien_similaire",
"frequency": "real_time",
"status": "inactive",
"type": "rent",
"user_id": 21578,
"affiliate_program_id": 1,
"locations": [{
"location_id": 7540,
"inf": 17138,
"sup": 17145
}, {
"location_id": 7647,
"inf": 17136,
"sup": 17137
}],
"property_classes": ["appartment", "house", "appartment",
"various"]
}]
}
}

So it search with inf AND sup but not on one location object. It seems ES
do : "inf greater than "any inf in apps.events.locations.¨" AND "sup less
than any sup"....
In my example, 98942 (inf) > 59850 AND 17213 (sup from same apps_events but
not same locations) < 59851 => wrong result.

Is that normal ? I don't like this behavious, I would like to compare
location per location...

Any ideas?
Thanks

--
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.

To achieve this locations have to be nested objects as well (the same way
as events)

On Tuesday, March 19, 2013 1:30:41 PM UTC-4, Fabien Guiraud wrote:

Hi,

I do that request :

curl -X GET '
http://78.109.90.3:9200/users/user/_search?from=0&load=&size=20&pretty'
-d '{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": [{
"nested": {
"path": "apps_events",
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": [{
"term": {
"apps_events.status": "active"
}
}, {
"or": [{
"and": [{
"range": {

"apps_events.locations.inf": {
"gte": 59850
}
}
}, {
"range": {

"apps_events.locations.sup": {
"lte": 59851
}
}
}]
}]
}]
}
}
}
}
}]
}
}
},
"size": 20,
"from": 0
}'

But it returns for example user like that :

{
"_index": "users",
"_type": "user",
"_id": "21578",
"_score": 1.0,
"_source": {
"_id": 21578,
"email": "x...@gmail.com <javascript:>",
"affiliate_program_id": 1,
"affiliate_state_id": 1,
"status": "no_verify",
"apps_events": [{
"id": 159026,
"source": "bien_similaire",
"frequency": "real_time",
"status": "active",
"type": "rent",
"user_id": 21578,
"affiliate_program_id": 1,
"locations": [{
"location_id": 7521,
"inf": 17198,
"sup": 17213
}, {
"location_id": 49364,
"inf": 98942,
"sup": 98943
}],
"property_classes": ["appartment", "house", "appartment",
"various"],
"price_min": "0",
"price_max": "1000"
}, {
"id": 99662,
"source": "bien_similaire",
"frequency": "real_time",
"status": "inactive",
"type": "rent",
"user_id": 21578,
"affiliate_program_id": 1,
"locations": [{
"location_id": 7540,
"inf": 17138,
"sup": 17145
}, {
"location_id": 7647,
"inf": 17136,
"sup": 17137
}],
"property_classes": ["appartment", "house", "appartment",
"various"]
}]
}
}

So it search with inf AND sup but not on one location object. It seems ES
do : "inf greater than "any inf in apps.events.locations.¨" AND "sup less
than any sup"....
In my example, 98942 (inf) > 59850 AND 17213 (sup from same apps_events
but not same locations) < 59851 => wrong result.

Is that normal ? I don't like this behavious, I would like to compare
location per location...

Any ideas?
Thanks

--
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.

Here is an example: https://groups.google.com/forum/?fromgroups=#!topic/elasticsearch/jxTuRGvsDqk · GitHub

On Tuesday, March 19, 2013 6:04:32 PM UTC-4, Igor Motov wrote:

To achieve this locations have to be nested objects as well (the same way
as events)

On Tuesday, March 19, 2013 1:30:41 PM UTC-4, Fabien Guiraud wrote:

Hi,

I do that request :

curl -X GET '
http://78.109.90.3:9200/users/user/_search?from=0&load=&size=20&pretty'
-d '{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": [{
"nested": {
"path": "apps_events",
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": [{
"term": {
"apps_events.status": "active"
}
}, {
"or": [{
"and": [{
"range": {

"apps_events.locations.inf": {
"gte": 59850
}
}
}, {
"range": {

"apps_events.locations.sup": {
"lte": 59851
}
}
}]
}]
}]
}
}
}
}
}]
}
}
},
"size": 20,
"from": 0
}'

But it returns for example user like that :

{
"_index": "users",
"_type": "user",
"_id": "21578",
"_score": 1.0,
"_source": {
"_id": 21578,
"email": "x...@gmail.com",
"affiliate_program_id": 1,
"affiliate_state_id": 1,
"status": "no_verify",
"apps_events": [{
"id": 159026,
"source": "bien_similaire",
"frequency": "real_time",
"status": "active",
"type": "rent",
"user_id": 21578,
"affiliate_program_id": 1,
"locations": [{
"location_id": 7521,
"inf": 17198,
"sup": 17213
}, {
"location_id": 49364,
"inf": 98942,
"sup": 98943
}],
"property_classes": ["appartment", "house", "appartment",
"various"],
"price_min": "0",
"price_max": "1000"
}, {
"id": 99662,
"source": "bien_similaire",
"frequency": "real_time",
"status": "inactive",
"type": "rent",
"user_id": 21578,
"affiliate_program_id": 1,
"locations": [{
"location_id": 7540,
"inf": 17138,
"sup": 17145
}, {
"location_id": 7647,
"inf": 17136,
"sup": 17137
}],
"property_classes": ["appartment", "house", "appartment",
"various"]
}]
}
}

So it search with inf AND sup but not on one location object. It seems ES
do : "inf greater than "any inf in apps.events.locations.¨" AND "sup less
than any sup"....
In my example, 98942 (inf) > 59850 AND 17213 (sup from same apps_events
but not same locations) < 59851 => wrong result.

Is that normal ? I don't like this behavious, I would like to compare
location per location...

Any ideas?
Thanks

--
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.

Okay, You're my god :slight_smile:

Thanks a lot lot lot ! If I can do anything for you, let me know.

On Wednesday, March 20, 2013 11:28:18 AM UTC+1, Igor Motov wrote:

Here is an example: https://groups.google.com/forum/?fromgroups=#!topic/elasticsearch/jxTuRGvsDqk · GitHub

On Tuesday, March 19, 2013 6:04:32 PM UTC-4, Igor Motov wrote:

To achieve this locations have to be nested objects as well (the same way
as events)

On Tuesday, March 19, 2013 1:30:41 PM UTC-4, Fabien Guiraud wrote:

Hi,

I do that request :

curl -X GET '
http://78.109.90.3:9200/users/user/_search?from=0&load=&size=20&pretty'
-d '{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": [{
"nested": {
"path": "apps_events",
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": [{
"term": {
"apps_events.status":
"active"
}
}, {
"or": [{
"and": [{
"range": {

"apps_events.locations.inf": {
"gte": 59850
}
}
}, {
"range": {

"apps_events.locations.sup": {
"lte": 59851
}
}
}]
}]
}]
}
}
}
}
}]
}
}
},
"size": 20,
"from": 0
}'

But it returns for example user like that :

{
"_index": "users",
"_type": "user",
"_id": "21578",
"_score": 1.0,
"_source": {
"_id": 21578,
"email": "x...@gmail.com",
"affiliate_program_id": 1,
"affiliate_state_id": 1,
"status": "no_verify",
"apps_events": [{
"id": 159026,
"source": "bien_similaire",
"frequency": "real_time",
"status": "active",
"type": "rent",
"user_id": 21578,
"affiliate_program_id": 1,
"locations": [{
"location_id": 7521,
"inf": 17198,
"sup": 17213
}, {
"location_id": 49364,
"inf": 98942,
"sup": 98943
}],
"property_classes": ["appartment", "house", "appartment",
"various"],
"price_min": "0",
"price_max": "1000"
}, {
"id": 99662,
"source": "bien_similaire",
"frequency": "real_time",
"status": "inactive",
"type": "rent",
"user_id": 21578,
"affiliate_program_id": 1,
"locations": [{
"location_id": 7540,
"inf": 17138,
"sup": 17145
}, {
"location_id": 7647,
"inf": 17136,
"sup": 17137
}],
"property_classes": ["appartment", "house", "appartment",
"various"]
}]
}
}

So it search with inf AND sup but not on one location object. It seems
ES do : "inf greater than "any inf in apps.events.locations.¨" AND "sup
less than any sup"....
In my example, 98942 (inf) > 59850 AND 17213 (sup from same apps_events
but not same locations) < 59851 => wrong result.

Is that normal ? I don't like this behavious, I would like to compare
location per location...

Any ideas?
Thanks

--
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.