Getting error when applying AND & OR filter

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting error when applying AND & OR filter

Johnson Cheng
I've spent quite sometime to google for the solution. I want to apply AND & OR filter together for my query but I'm getting error message returned

" filter malformed, must start with start_object"

My filter query as below:

filter: {
            "and":  [{"not":
                                {"terms":
                                     {"article_id":["72A3F3E1-82AF-46E3-9DCC579ED6D36735"]}
                                 }
                          },
                           {"terms":
                                    {"page_type":["article"]}
                           },
                           {"or":
                                 {"terms":{"document_types":["F04CA6D9-27CA-45FD-985371B7DD283452","5D95860A-6219-4ED0-A085DE269D562300"]}
                                 }
                          }]
           }

Can anyone help please?

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Getting error when applying AND & OR filter

Radu Gheorghe-2
Hello,

I think the problem is that your "or" filter expects an array of filters, and not just one filter.

If I'm not guessing right, can you provide a curl recreation of the problem? I think that will make things easier to diagnose.

Best regards,
Radu
--
http://sematext.com/ -- Elasticsearch -- Solr -- Lucene


On Thu, Aug 1, 2013 at 3:58 PM, Johnson Cheng <[hidden email]> wrote:
I've spent quite sometime to google for the solution. I want to apply AND & OR filter together for my query but I'm getting error message returned

" filter malformed, must start with start_object"

My filter query as below:

filter: {
            "and":  [{"not":
                                {"terms":
                                     {"article_id":["72A3F3E1-82AF-46E3-9DCC579ED6D36735"]}
                                 }
                          },
                           {"terms":
                                    {"page_type":["article"]}
                           },
                           {"or":
                                 {"terms":{"document_types":["F04CA6D9-27CA-45FD-985371B7DD283452","5D95860A-6219-4ED0-A085DE269D562300"]}
                                 }
                          }]
           }

Can anyone help please?

--
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 [hidden email].
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.