Hello,
I first want to declare that I have been introduced to the world of elasticsearch just a week back, so there could be some obvious points I might be missing while addressing my problems.
However, there is one particular problem, I just can't seem to find a solution to, after exhaustively trying to find and answer, so I would like some help here.
I have created a dummy index to explain my problem.
Now my problem required me to make a query that applies some filter on city, and some filter on attributes.rating, and gives me back just the attribute ids. There doesn't seem to be an exact solution for this, but I have been able to get it working by using inner_hits and adding id to the inner_hits' fields. Like this:
The second part of my problem requires me to return the attribute id in sorted order.
So from above query how can I get attribute.id, sorted by rating in ascending order. This means that i should get Ids in sequence 6, 2, 5. However, since in my response I get the parent, not the nested doc, and since 5 and 6 are in one parent, and 2 in another, does my problem even have a solution?
Hello, I first want to declare that I have been introduced to the world of elasticsearch just a week back, so there could be some obvious points I might be missing while addressing my problems.
However, there is one particular problem, I just can't seem to find a solution to, after exhaustively trying to find and answer, so I would like some help here.
I have created a dummy index to explain my problem.
The mapping is :
'attributes' is nested, and we are storing the 'attributes.id'
I populated this with following entries:
Now my problem required me to make a query that applies some filter on city, and some filter on attributes.rating, and gives me back just the attribute ids. There doesn't seem to be an exact solution for this, but I have been able to get it working by using inner_hits and adding id to the inner_hits' fields. Like this:
This gives me the following response:
The second part of my problem requires me to return the attribute id in sorted order. So from above query how can I get attribute.id, sorted by rating in ascending order. This means that i should get Ids in sequence 6, 2, 5. However, since in my response I get the parent, not the nested doc, and since 5 and 6 are in one parent, and 2 in another, does my problem even have a solution?