elasticsearch get statistics on analyzed field -


i trying statistics on analyzed string field.

i trying avg length of string field (in example title, , title can empty/none).

tried:

get book/_search {       "facets" : {           "stat1" : {               "statistical" : {                   "script" : "_source.title?.length()"               }           }       }  } 

and error:

query failed [failed execute main query]]; nested: nullpointerexception; }]",    "status": 500 } 

how can accomplish that?

any reason why using facets , not aggregations? unless use elasticsearch version supports facets, recommend switching aggregations. facets deprecated in 1.x , removed in 2.x.

and aggregation 1 should work fine:

get /book/_search {   "aggs": {     "stat1": {       "stats": {         "script": "_source.title?.length() ?: 0"       }     }   } } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -