I use aggregrations on elasticsearch version 1.3.8. I use aggregation script 
for awhile today ıt didnt work. Please help ı cant find any solution : 

This the mapping:

      "mappings": {
         "product": {
            "properties": {
               "brandId": {
                  "type": "integer"
               },
               "brandIsActive": {
                  "type": "boolean"
               },
               "brandLink": {
                  "type": "string",
                  "index": "not_analyzed"
               },
               "brandName": {
                  "type": "string",
                  "index": "not_analyzed"
               }

          }

       }

}


this my query:


post alias-test/product/_search
{
    "query": {
        "match_all": {}
    },
    "aggs": {
       "Brand": {
         "terms": {
             "script": "doc['brandName'].value",
             "size": 0
                  } 
                } 
             }          
}

This is the error:

{
   "error": "SearchPhaseExecutionException[Failed to execute phase 
[query_fetch], all shards failed; shardFailures {[g][mizu-20150219142655][0]: 
RemoteTransportException[[Mammomax][inet[/172.31.37.148:9300]][search/phase/query+fetch]];
 nested: SearchParseException[[mizu-20150219142655][0]: 
query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [Failed to parse 
source 
[{\"query\":{\"match_all\":{}},\"aggs\":{\"Brand\":{\"terms\":{\"script\":\"doc['brandName'].value\"}}}}]]];
 nested: ExpressionScriptCompilationException[Field [brandName] used in 
expression must be numeric]; }]",
   "status": 400
}


The other query :

post test/product/_search
{
    "query": {
        "match_all": {}
    },
    "aggs": {
       "Brand": {
         "terms": {
             "script": "doc['brandName'].value+'|'+doc['brandLink'].value",
             "size": 0
                  } 
                } 
             }          
}


the error :

post test/product/_search
{
    "query": {
        "match_all": {}
    },
    "aggs": {
       "Brand": {
         "terms": {
             "script": "doc['brandName'].value+'|'+doc['brandLink'].value",
             "size": 0
                  } 
                } 
             }          
}

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/1af39cb0-893d-4a7d-b9e1-a061eed48de6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to