Can you answer what's wrong with the gist, i've provided? I can't figure out... I provide you all the data I have, related to this issue. Look: 1) The elasticsearch index, containing the products and its options, which have to be filtered: https://gist.github.com/ArFeRR/de86b8b0a5f2bc7dfd86 2) The JSON query for the filtration: https://gist.github.com/ArFeRR/e159ef1047122a617b88 3)The ELastica.io code to genereate the json above on PHP: https://gist.github.com/ArFeRR/cebb2bf54232069d817b#file-gistfile1-php
(I've changed the data to make it more real) All the json works fine, i've tested it! Can't figure out what's wrong and what I have to do to provide a "FULL working GIST" for you четверг, 10 июля 2014 г., 18:37:19 UTC+3 пользователь David Pilato написал: > > Have a look at this page to see how you can build a full working GIST > which could help us to reproduce your use case. > > When your GIST will be updated, please update this thread so I can look at > it. > > -- > *David Pilato* | *Technical Advocate* | *Elasticsearch.com* > @dadoonet <https://twitter.com/dadoonet> | @elasticsearchfr > <https://twitter.com/elasticsearchfr> > > > Le 10 juillet 2014 à 11:59:22, Artem Frolov ([email protected] > <javascript:>) a écrit: > > the GIST: > https://gist.github.com/ArFeRR/630acb216b8d95168b73 > > четверг, 10 июля 2014 г., 12:51:49 UTC+3 пользователь Artem Frolov > написал: >> >> here's my try to solve it: >> >> { >> "filtered":{ >> "filter":{ >> "nested":{ >> "path":"productsOptionValues", >> "filter":{ >> "and":[ >> { >> "or":[ >> { >> "and":[ >> { >> "term":{ >> "productsOptionValues.productOption": >> "weight" >> } >> }, >> { >> "term":{ >> "productsOptionValues.value":"500 kg" >> } >> } >> ] >> }, >> { >> "and":[ >> { >> "term":{ >> "productsOptionValues.productOption": >> "weight" >> } >> }, >> { >> "term":{ >> "productsOptionValues.value":"50kg" >> } >> } >> ] >> } >> ] >> }, >> { >> "or":[ >> { >> "and":[ >> { >> "term":{ >> "productsOptionValues.productOption": >> "magic" >> } >> }, >> { >> "term":{ >> "productsOptionValues.value":"no" >> } >> } >> ] >> } >> ] >> } >> ] >> } >> } >> } >> } >> } >> >> but it's an equivalent of: >> >> WHERE ((option = "weight" AND value = "50kg")OR (option = "weight" AND value >> = "500kg"))AND (option = "magic" AND value = "no") >> >> it's wrong tree... I need the and\or logic to be at one branch of the json >> tree. I don't know if it possible. Please help to translate the logic from >> the query where condition! >> >> >> четверг, 10 июля 2014 г., 12:23:05 UTC+3 пользователь David Pilato >> написал: >>> >>> It could help if you could gist a full SENSE/curl script recreation >>> >>> Best >>> >>> -- >>> David ;-) >>> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs >>> >>> Le 10 juil. 2014 à 11:15, Artem Frolov <[email protected]> a écrit : >>> >>> I have a WHERE clause in my SQL query, which have to be translated >>> into the elasticsearch bool filter. >>> >>> here's the where clause: >>> >>> WHERE (option = "weight" AND value = "50kg")OR (option = "weight" AND value >>> = "500kg")AND (option = "magic" AND value = "no") >>> >>> I have written the AND filters for inner ANDs of query, but now I need >>> to put them to the bool filter. >>> >>> Tried to: >>> >>> $boolFilter = new >>> \Elastica\Filter\Bool();$boolFilter->addShould($innerFilterAnd1);$boolFilter->addShould($innerFilterAnd2);$boolFilter->addMust($innerFilterAnd3); >>> >>> returns nothing. >>> >>> Please, help! >>> -- >>> 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 [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/elasticsearch/5291b465-50d1-42da-a8a0-45ee154c1838%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/elasticsearch/5291b465-50d1-42da-a8a0-45ee154c1838%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >>> -- > 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 [email protected] <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/70db39db-2317-46bc-a2a9-6011f454b46d%40googlegroups.com > > <https://groups.google.com/d/msgid/elasticsearch/70db39db-2317-46bc-a2a9-6011f454b46d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1ee83ee3-09a6-414f-87fe-faf9f97d06a6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
