Not able to pass multiple term in bool query

Hi,

I'm trying to make a bool query where sending mutiple term under should
block as given in link
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html

But I'm getting SearchPhaseExecutionException while trying to execute below
query. Please inform what is the correct way to send the query

POST /aricloud/_search
{
"query": {
"filtered": {
"query": {
"bool": {
"must": [
{
"range": {
"NODE_CATEGORY_ID": {
"gte": 10,
"lte": 20,
"boost": 2.0
}
}
}
] ,
"must_not": [
{
"term": {
"NODE_ID": {
"value": "12235"
}
}
}
],
"should": [
{
"term": {
"NODE_PRIVATE_IP_ADDRESS": {
"value": "10.123.124.40"
}
},
"term": {
"NODE_PUBLIC_IP_ADDRESS": {
"value": "125.31.108.72"
}
}
}
}
]
}
},
"filter": {
"range": {
"NODE_CREATE_TIME": {
"from": "2014-03-14 16:22:35",
"to": "2014-03-14 22:43:55"
}
}
}
}
},
"sort": [
{
"NODE_ID": {
"order": "asc"
}
}
]
}

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/fb6b4846-7ceb-4046-a17b-c33de4d7bc79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I just tried to copy and paste your JSON in: http://jsonformatter.curiousconcept.com/
I get

Error:Expecting comma or ], not }.[Code 6, Structure 86]
Error:Expecting comma or }, not ].[Code 7, Structure 87]
Error:Multiple JSON root elements[Code 22, Structure 115]
Error:Extra closing }[Code 14, Structure 126]
I think you should fix your JSON and check that it's correct before sending it to elasticsearch

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 17 mars 2014 à 10:21:20, Subhadip Bagui (i.bagui@gmail.com) a écrit:

Hi,

I'm trying to make a bool query where sending mutiple term under should block as given in link http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html

But I'm getting SearchPhaseExecutionException while trying to execute below query. Please inform what is the correct way to send the query

POST /aricloud/_search
{
"query": {
"filtered": {
"query": {
"bool": {
"must": [
{
"range": {
"NODE_CATEGORY_ID": {
"gte": 10,
"lte": 20,
"boost": 2.0
}
}
}
] ,
"must_not": [
{
"term": {
"NODE_ID": {
"value": "12235"
}
}
}
],
"should": [
{
"term": {
"NODE_PRIVATE_IP_ADDRESS": {
"value": "10.123.124.40"
}
},
"term": {
"NODE_PUBLIC_IP_ADDRESS": {
"value": "125.31.108.72"
}
}
}
}
]
}
},
"filter": {
"range": {
"NODE_CREATE_TIME": {
"from": "2014-03-14 16:22:35",
"to": "2014-03-14 22:43:55"
}
}
}
}
},
"sort": [
{
"NODE_ID": {
"order": "asc"
}
}
]
}

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/fb6b4846-7ceb-4046-a17b-c33de4d7bc79%40googlegroups.com.
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.5326bf3a.7724c67e.1ccf%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/d/optout.

My mistake!! the json format was wrong. tried below and it's working fine.

Thanks David

{
"query": {
"filtered": {
"query": {
"bool": {
"must": [
{
"range": {
"NODE_CATEGORY_ID": {
"gte": 10,
"lte": 20,
"boost": 2
}
}
}
],
"must_not": [
{
"term": {
"NODE_ID": {
"value": "12235"
}
}
}
],
"should": [
{
"term": {
"NODE_PRIVATE_IP_ADDRESS": {
"value": "10.123.124.125"
}
}
},
{
"term": {
"NODE_PUBLIC_IP_ADDRESS": {
"value": "125.31.108.82"
}
}
}
]
}
},
"filter": {
"range": {
"NODE_CREATE_TIME": {
"from": "2014-03-14 16:22:35",
"to": "2014-03-14 22:43:55"
}
}
}
}
},
"sort": [
{
"NODE_ID": {
"order": "asc"
}
}
]
}

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/571c5fe8-3219-46fa-82f4-6d3456e09d07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Can you show the full error message details?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/6329cba2-2f9a-431d-ad6f-c41d7af127c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Binh,

I was an issue with json format creation. Now I validated the json and
getting result.
Thanks..

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/19af3f5d-b17d-4f9f-863c-b10adaffe27f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.