What's wrong with this query?


(Baishampayan Ghose) #1

Hi,

I am trying to query my index with a couple of filters like below but
I am getting a QueryParsingException.

My query looks like this -

Can anyone tell me where I am doing it wrong?

I am just using a HTTP client at the moment.

Thanks in advance.

Regards,
BG

--
Baishampayan Ghose
b.ghose at gmail.com


(Baishampayan Ghose) #2

FWIW, I converted the original query document to a bool filter with
must & should instead and it worked fine.

Does that mean and & or filters can't be combined together?

Regards,
BG

On Tue, Jul 10, 2012 at 4:20 PM, Baishampayan Ghose b.ghose@gmail.com wrote:

Hi,

I am trying to query my index with a couple of filters like below but
I am getting a QueryParsingException.

My query looks like this -

https://gist.github.com/3082632

Can anyone tell me where I am doing it wrong?

I am just using a HTTP client at the moment.

Thanks in advance.

Regards,
BG

--
Baishampayan Ghose
b.ghose at gmail.com

--
Baishampayan Ghose
b.ghose at gmail.com


(Igor Motov) #3

They can be combined like this:

    "and": [{
      "or": [{
        "term": {
          "publish_id": "1"
        }
      }, {
        "term": {
          "publish_id": "10"
        }
      }]
    }, {
      "term": {
        "assignee": "unassigned"
      }
    }, {
      "term": {
        "priority": 1
      }
    }, {
      "term": {
        "tags": "foo"
      }
    }]

On Tuesday, July 10, 2012 7:55:40 AM UTC-4, Baishampayan Ghose wrote:

FWIW, I converted the original query document to a bool filter with
must & should instead and it worked fine.

Does that mean and & or filters can't be combined together?

Regards,
BG

On Tue, Jul 10, 2012 at 4:20 PM, Baishampayan Ghose b.ghose@gmail.com
wrote:

Hi,

I am trying to query my index with a couple of filters like below but
I am getting a QueryParsingException.

My query looks like this -

https://gist.github.com/3082632

Can anyone tell me where I am doing it wrong?

I am just using a HTTP client at the moment.

Thanks in advance.

Regards,
BG

--
Baishampayan Ghose
b.ghose at gmail.com

--
Baishampayan Ghose
b.ghose at gmail.com


(Baishampayan Ghose) #4

Thanks, Igor!

Regards,
BG

On Tue, Jul 10, 2012 at 7:49 PM, Igor Motov imotov@gmail.com wrote:

They can be combined like this:

    "and": [{
      "or": [{
        "term": {
          "publish_id": "1"
        }
      }, {
        "term": {
          "publish_id": "10"
        }
      }]
    }, {
      "term": {
        "assignee": "unassigned"
      }
    }, {
      "term": {
        "priority": 1
      }
    }, {
      "term": {
        "tags": "foo"
      }
    }]

On Tuesday, July 10, 2012 7:55:40 AM UTC-4, Baishampayan Ghose wrote:

FWIW, I converted the original query document to a bool filter with
must & should instead and it worked fine.

Does that mean and & or filters can't be combined together?

Regards,
BG

On Tue, Jul 10, 2012 at 4:20 PM, Baishampayan Ghose b.ghose@gmail.com
wrote:

Hi,

I am trying to query my index with a couple of filters like below but
I am getting a QueryParsingException.

My query looks like this -

https://gist.github.com/3082632

Can anyone tell me where I am doing it wrong?

I am just using a HTTP client at the moment.

Thanks in advance.

Regards,
BG

--
Baishampayan Ghose
b.ghose at gmail.com

--
Baishampayan Ghose
b.ghose at gmail.com

--
Baishampayan Ghose
b.ghose at gmail.com


(system) #5