Filtered not working with has_parent in elasticsearch 1.3.0

In elasticsearch 1.3.0 filtered not working with has_parent. In elasticsearch
0.90.5
its working fine.

I am using below query. In this query I need add filtered inside
has_parent->query->filtered->bool->must. But my basic query is not
working.

{
   "query": {
      "has_parent": {
         "parent_type": "url",
         "query": {
           "match": {
              "affiliate_id": "1718489511"
           }
         }
      },
      "filtered": {
         "filter": {
            "bool": {
               "must": {
                  "terms": {
                     "country": [
                        "india"
                     ]
                  }
               }
            }
         }
      }
   }
}

Getting error message* ElasticsearchParseException[Expected field name but
got START_OBJECT "filtered"*

Complete Error Message:-

error: SearchPhaseExecutionException[Failed to execute phase [query], all
shards failed;
shardFailures {[hZgYLUmsQL2T8z1MY2eyNA][esindex][5]:
SearchParseException[[esindex][5]:
query[parent_filter[url](filtered(affiliate_id:1718489511)->cache(_type
:url))],from[-1],size[-1]:
Parse Failure [Failed to parse source [{"query":{"has_parent":{
"parent_type":"url","query":{"match":{"affiliate_id":"1718489511"}}},
"filtered":{"filter":{"bool":{"must":{"terms":{"country":["india"
]}}}}}}}]]];
nested: ElasticsearchParseException[Expected field name but got
START_OBJECT "filtered"]; }
{[OPG4zuQlQr2dFxUvRe2GWg][esindex][4]: RemoteTransportException[[
server1][inet[/127.0.0.1:9300]]
[search/phase/query]]; nested: SearchParseException[[esindex][4]: query
[parent_filter[url]
(filtered(affiliate_id:1718489511)->cache(_type:url))],from[-1],size[-1
]: Parse Failure
[Failed to parse source [{"query":{"has_parent":{"parent_type":"url",
"query":{"match":{"affiliate_id":"1718489511"}}},
"filtered":{"filter":{"bool":{"must":{"terms":{"country":["india"
]}}}}}}}]]];
nested: ElasticsearchParseException[Expected field name but got
START_OBJECT "filtered"]; }

Any suggestion?

--
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/683129a1-c757-4250-a97e-a15a4efbbaa5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Any Suggestion??

On Monday, 15 September 2014 23:31:26 UTC+5:30, Roopendra Vishwakarma wrote:

In elasticsearch 1.3.0 filtered not working with has_parent. In elasticsearch
0.90.5
its working fine.

I am using below query. In this query I need add filtered inside
has_parent->query->filtered->bool->must. But my basic query is not
working.

{
   "query": {
      "has_parent": {
         "parent_type": "url",
         "query": {
           "match": {
              "affiliate_id": "1718489511"
           }
         }
      },
      "filtered": {
         "filter": {
            "bool": {
               "must": {
                  "terms": {
                     "country": [
                        "india"
                     ]
                  }
               }
            }
         }
      }
   }
}

Getting error message* ElasticsearchParseException[Expected field name
but got START_OBJECT "filtered"*

Complete Error Message:-

error: SearchPhaseExecutionException[Failed to execute phase [query], all
shards failed;
shardFailures {[hZgYLUmsQL2T8z1MY2eyNA][esindex][5]:
SearchParseException[[esindex][5]:
query[parent_filter[url](filtered(affiliate_id:1718489511)->cache(
_type:url))],from[-1],size[-1]:
Parse Failure [Failed to parse source [{"query":{"has_parent":{
"parent_type":"url","query":{"match":{"affiliate_id":"1718489511"}}},
"filtered":{"filter":{"bool":{"must":{"terms":{"country":["india"
]}}}}}}}]]];
nested: ElasticsearchParseException[Expected field name but got
START_OBJECT "filtered"]; }
{[OPG4zuQlQr2dFxUvRe2GWg][esindex][4]: RemoteTransportException[[
server1][inet[/127.0.0.1:9300]]
[search/phase/query]]; nested: SearchParseException[[esindex][4]:
query[parent_filter[url]
(filtered(affiliate_id:1718489511)->cache(_type:url))],from[-1],size
[-1]: Parse Failure
[Failed to parse source [{"query":{"has_parent":{"parent_type":"url",
"query":{"match":{"affiliate_id":"1718489511"}}},
"filtered":{"filter":{"bool":{"must":{"terms":{"country":["india"
]}}}}}}}]]];
nested: ElasticsearchParseException[Expected field name but got
START_OBJECT "filtered"]; }

Any suggestion?

--
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/0fb732f3-cc39-4de8-8ee4-52949ee8ca98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

You need to wrap the has_parent query in the query part of the filtered
query:

I don't see how this query could have worked in 0.90.5, since the format is
incorrect, but if you wrap your has_parent query inside the filtered
query's query attribute then the format is correct and the query should
work.

On 16 September 2014 13:27, Roopendra Vishwakarma roopendramca@gmail.com
wrote:

Any Suggestion??

On Monday, 15 September 2014 23:31:26 UTC+5:30, Roopendra Vishwakarma
wrote:

In elasticsearch 1.3.0 filtered not working with has_parent. In elasticsearch
0.90.5
its working fine.

I am using below query. In this query I need add filtered inside
has_parent->query->filtered->bool->must. But my basic query is not
working.

{
   "query": {
      "has_parent": {
         "parent_type": "url",
         "query": {
           "match": {
              "affiliate_id": "1718489511"
           }
         }
      },
      "filtered": {
         "filter": {
            "bool": {
               "must": {
                  "terms": {
                     "country": [
                        "india"
                     ]
                  }
               }
            }
         }
      }
   }
}

Getting error message* ElasticsearchParseException[Expected field name
but got START_OBJECT "filtered"*

Complete Error Message:-

error: SearchPhaseExecutionException[Failed to execute phase [query],
all shards failed;
shardFailures {[hZgYLUmsQL2T8z1MY2eyNA][esindex][5]:
SearchParseException[[esindex][5]:
query[parent_filter[url](filtered(affiliate_id:1718489511)->cache(
_type:url))],from[-1],size[-1]:
Parse Failure [Failed to parse source [{"query":{"has_parent":{"
parent_type":"url","query":{"match":{"affiliate_id":"1718489511"}}},
"filtered":{"filter":{"bool":{"must":{"terms":{"country":["india"
]}}}}}}}]]];
nested: ElasticsearchParseException[Expected field name but got
START_OBJECT "filtered"]; }
{[OPG4zuQlQr2dFxUvRe2GWg][esindex][4]: RemoteTransportException[[
server1][inet[/127.0.0.1:9300]]
[search/phase/query]]; nested: SearchParseException[[esindex][4]:
query[parent_filter[url]
(filtered(affiliate_id:1718489511)->cache(_type:url))],from[-1],size
[-1]: Parse Failure
[Failed to parse source [{"query":{"has_parent":{"parent_type":"url"
,"query":{"match":{"affiliate_id":"1718489511"}}},
"filtered":{"filter":{"bool":{"must":{"terms":{"country":["india"
]}}}}}}}]]];
nested: ElasticsearchParseException[Expected field name but got
START_OBJECT "filtered"]; }

Any suggestion?

--
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/0fb732f3-cc39-4de8-8ee4-52949ee8ca98%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/0fb732f3-cc39-4de8-8ee4-52949ee8ca98%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
Met vriendelijke groet,

Martijn van Groningen

--
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/CA%2BA76Tysp1bFs5A6Ec9rFGUjpQM8%2BTEUMJ5AGjf3cdUKWamw2g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.