Thanks Damien.
*
*
It seems to work now with a Nested Filter. I had tried it out earlier
before asking this question in the Elasticsearch HEAD
pluginhttp://mobz.github.io/elasticsearch-head/,
but it seemed to fail using the GET call. I now tried it out using a POST
call for which it seems to work. Using the CURL command it works for both
scenarios.
I then tried out using the Nested Query for which I can't seem to make
it work. Here's a mapping of the index against which I am trying it out..
- mappings: {
- nested_author: {
- properties: {
- books: {
- properties: {
- genre: {
- name: {
- publisher: {
- type: nested
}
- name: {
Some test data ...
curl -XPUT localhost:9200/authors/nested_author/1 -d'{
"name": "Multi G. Enre",
"books": [
{
-
"name": "Guns and lasers",*
-
"genre": "scifi",*
-
"publisher": "orbit"*
},
{
-
"name": "Dead in the night",*
-
"genre": "thriller",*
-
"publisher": "penguin"*
}
]
}'
curl -XPUT localhost:9200/authors/nested_author/2 -d'{
"name": "Alastair Reynolds",
"books": [
{
- "name": "Revelation Space",*
- "genre": "scifi",*
- "publisher": "penguin"*
}
]
}'
I made this query to search for records, but it results in a *
SearchPhaseExecutionException*
curl -XPOST localhost:9200/authors/nested_author/_search -d '
{
Can you spot any issues with the query or the mapping itself for which the
query might be failing ???
Thanks again.. You have been of great help.
Regards
Manoj Mohan
Intelligrape Software
On Tue, Aug 6, 2013 at 3:25 PM, Damien Alexandre dalexandre@jolicode.comwrote:
On Tuesday, August 6, 2013 11:51:33 AM UTC+2, Manoj Mohan wrote:
Thanks for the reply Damien.
But the problem with nested objects is that there can be a cross match
that results in a fake result as mentioned in this doc
http://www.elasticsearch.**org/guide/reference/mapping/**nested-type/http://www.elasticsearch.org/guide/reference/mapping/nested-type/
.
So a product having 2 variations -
Price : $50
Color:Blue
Price: $20
Color:Black
Here searching for a Blue colored product under $30 would give back the
product having the above variations, which is a big problem there isn't a
variation that matches the criteria.
This can be avoid using NestedQuery:
Elasticsearch Platform — Find real-time answers at scale | Elastic (or
filter).
I use them a lot and that works fine for this case.
Regards
Manoj Mohan
Intelligrape Software
On Tue, Aug 6, 2013 at 1:56 PM, Damien Alexandre dalex...@jolicode.comwrote:
From my POV: stay away from has_child and has_parent query if you need
facets - that can't work: you will not be able to perform "color" facet if
the field is not on the product document.
My best guest whould be that the product document should host his
variations (maybe in a nested objecthttp://www.elasticsearch.org/guide/reference/mapping/nested-type/to ease the query against some variation only).
Having everything in the same doc will also ease indexing & update &
query against everything.
My 2cts
Damien
On Tuesday, July 30, 2013 11:56:56 AM UTC+2, Manoj Mohan wrote:
Hi,
I am working on an application that uses Elasticsearch for providing a
searching across the application. Now I have a scenario where a Product can
have many variations depending on it's colors. So a product A available in
Blue and Green will have 2 Product variations and a Product entity indexed
into ES. Now each of the product variations will contain some specific
fields not present in the Product domain. Also I have marked the Product -
ProductVariation relationship with a parent-child relationship(Product
being the parent).
Now I have a case of searching for a products using a free text search.
Since I have different fields in those domains, I would have to search
across both the domains. What I would essentially like to have is that I
make a single query to search across a product and it's related child
ProductVariation to get a match Eg: Blue jeans search should search across
both where blue is the color present in ProductVariation and Jeans is a
category in Product. Also I intend to provide filtering/faceting over these
fields.
How would I do a search and across which domain. I am tried out the
has_child and has_parent queries but am a bit skeptical about the results.
Any help would be greatly appreciated.
Regards
Manoj Mohan
--
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/Y-**AxvhSyhXU/unsubscribehttps://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to
elasticsearc...@**googlegroups.com.
For more options, visit https://groups.google.com/**groups/opt_outhttps://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/Y-AxvhSyhXU/unsubscribe.
To unsubscribe from this group and all its topics, 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.