Hello folks,
I have a nested query:
"query":
{"filtered":{"query":{"match_all":{}},"filter":{"nested":{"path":"browse","filter":{"bool":{"must":[{"term":{"browse.subcat.raw":["desktop
tower"]}}]}}}}}}
as you can see, browse is a nested object. subcat.raw is using keyword
tokenizer.
the above query can return a customer with customerId1,
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "user_activity",
"_type": "2015-02-15",
"_id": "customerid1",
"_score": 1,
"_source": {
"browse": [
{
"item_id": "item1",
"subcat": "DESKTOP TOWER"
"event_time": "2015-02-15"
}
]
}
}
]
similarly if I do another query
"query":
{"filtered":{"query":{"match_all":{}},"filter":{"nested":{"path":"browse","filter":{"bool":{"must":[{"term":{"browse.subcat.raw":["knit
tops"]}}]}}}}}}
It will return another customer customerId2
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "user_activity_v2",
"_type": "2015-02-15",
"_id": "customerId2",
"_score": 1,
"_source": {
"browse": [
{
"item_id": "item3",
"subcat": "KNIT TOPS",
"event_time": "2015-02-15"
},
{
"item_id": "item4",
"subcat": "ACTIVEWEAR",
"event_time": "2015-02-15"
},
{
"item_id": "item5",
"subcat": "ACTIVEWEAR",
"event_time": "2015-02-15"
}
]
}
}
]
}
But if i combined these two queries together:
"query":
{"filtered":{"query":{"match_all":{}},"filter":{"nested":{"path":"browse","filter":{"bool":{"must":[{"term":{"browse.subcat.raw":["knit
tops","desktop tower"]}}]}}}}}}
It only returns customerId1. which corresponds to "desktop tower". It seems
that the combined query always return the matched customer_id for the last
search term in the browse.subcat.raw.
Is this expected? or i am doing something wrong? I am hoping the combined
query would return both customerId1, and customerId2
Chen
--
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/a88cd340-76ef-4a6b-a647-baa253b23fb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.