"Unknown BaseAggregationBuilder [significant_text]" in Elastic search 5.3.2 version - elasticsearch

to achieve aggregation for text field i tried giving
"aggs": {
"keywords": {
"significant_text": {
"field": "testId",
"min_doc_count":1
}
}
}
this works fine in elk 6.6.1 version. but in ELK 5.3.1 version it throws an error
{
"error": {
"root_cause": [
{
"type": "unknown_named_object_exception",
"reason": "Unknown BaseAggregationBuilder [significant_text]",
"line": 107,
"col": 27
}
],
"type": "unknown_named_object_exception",
"reason": "Unknown BaseAggregationBuilder [significant_text]",
"line": 107,
"col": 27`enter code here`
},
"status": 400
}
can anyone please help me in sorting this out ?

Significant text aggregation was introduced in the 6.0 elasticsearch version, due to this for ELK version 5.3.1, you are getting the below error
"Unknown BaseAggregationBuilder [significant_text]",

Related

mapper_parsing_exception while import dashboard to kibana

When I import a dashboard from kibana 7.5.1 to kibana 7.4.1, it failed with error "the file could not be processed". I call kibana import object api on kibana dev tool console instead, and it provide following response:
POST /api/saved_objects/_import
{
"file" : "C:\Users\dashboards-kibana\EKC-Dashboard-Prod.ndjson"
}
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to parse"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to parse",
"caused_by": {
"type": "json_parse_exception",
"reason": "Unrecognized character escape 'U' (code 85)\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper#33da7471; line: 2, column: 17]"
}
},
"status": 400
}
This is my first time work with kibana. Is there anyway to solve the import error?

Return only count value on _count query

Executing the following
http://172.21.21.151:9200/printer-stats-*/_doc/_count
I get the following response
{
"count": 19299,
"_shards": {
"total": 44,
"successful": 44,
"skipped": 0,
"failed": 0
}
}
How can i modify the query to only return
{
"count": 19299
}
On _search queries we can use filter_path to only get the desired output, but this is not working on count as it seems.
I also tried to add a body like the following
{
"_shards": false
}
But it throws the following error
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "request does not support [_shards]",
"line": 2,
"col": 3
}
],
"type": "parsing_exception",
"reason": "request does not support [_shards]",
"line": 2,
"col": 3
},
"status": 400
}
My version is 7.9.2
Probably this has been asked before, but I have not found a relevant question.
filter_path definitely works on the _count endpoint:
http://172.21.21.151:9200/printer-stats-*/_doc/_count?filter_path=count
Response =>
{
"count": 19299
}

filters defined in elasticsearch.yml not working

I tried defining a custom filter in elasticsearch.yml as below and restarted the node:
index:
analysis:
filter:
myTokenFilter2:
type: length
min: 2
max: 5
and tried to use it.
curl -XPOST localhost:9200/_analyze?tokenizer=standard&filters=myTokenFilter2 -d "a aa aaaa aaaaaa",
only to find this in the response json
{
"error": {
"root_cause": [
{
"type": "remote_transport_exception",
"reason": "[Domina][127.0.0.1:9300][indices:admin/analyze[s]]"
}
],
"type": "illegal_argument_exception",
"reason": "failed to find global token filter under [myTokenFilter2]"
},
"status": 400
}
what's wrong with my config? Thank you

elasticsearch:script sometimes works ok sometimes throw an exception

My elasticsearch script sometimes works ok,and sometimes throw an exception,such as:
{
"error": {
"root_cause": [
{
"type": "remote_transport_exception",
"reason": "[es77][ip:9300] [indices:data/write/update[s]]"
}
],
"type": "illegal_argument_exception",
"reason": "failed to execute script",
"caused_by": {
"type": "script_exception",
"reason": "failed to run inline script [newArray = [];ctx._source.CILastCallResultRemark?.each{ obj->if(obj.id!=item.id){newArray=newArray+obj} }; (ctx._source.CILastCallResultRemark=newArray+item)] using lang [groovy]",
"caused_by": {
"type": "no_class_def_found_error",
"reason": "sun/reflect/MethodAccessorImpl",
"caused_by": {
"type": "class_not_found_exception",
"reason": "sun.reflect.MethodAccessorImpl"
}
}
}
},
"status": 400
}
Here is the script:
{
"script": {
"inline": "newArray = [];ctx._source.CILastCallResultRemark?.each{ obj->if(obj.id!=item.id){newArray=newArray+obj}};(ctx._source.CILastCallResultRemark=newArray+item)",
"params": {
"item": {
"id": "2",
"remart": "x1"
}
}
}
}
And here is the es log:
Caused by: ScriptException[failed to run inline script [newArray = [];ctx._source.CILastCallResultRemark?.each{ obj->if(obj.id!=item.id){newArray=newArray+obj}};(ctx._source.CILastCallResultRemark=newArray+item)] using lang [groovy]]; nested: NoClassDefFoundError[sun/reflect/MethodAccessorImpl]; nested: ClassNotFoundException[sun.reflect.MethodAccessorImpl];
at org.elasticsearch.script.groovy.GroovyScriptEngineService$GroovyScript.run(GroovyScriptEngineService.java:318)
at org.elasticsearch.action.update.UpdateHelper.executeScript(UpdateHelper.java:251)
... 12 more
Caused by: java.lang.NoClassDefFoundError: sun/reflect/MethodAccessorImpl
i see the bug.i will update the es version and try.

partial fields in elasticsearch2.2.0 is not working?

May i know the details why the partial fields is not working in elasticsearch 2.2.0.I recently upgraded from elasticsearch 1.7.2 to elasticsearch 2.2.0.In older version it is working but after upgration results are not coming and raising an exception.
Pls find error for your reference
{
"error": {
"root_cause": [
{
"type": "search_parse_exception",
"reason": "failed to parse search source. unknown search element [partial_fields]",
"line": 79,
"col": 4
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "candidates1",
"node": "tlFrZ6JKTOWJ6krrkRnhMw",
"reason": {
"type": "search_parse_exception",
"reason": "failed to parse search source. unknown search element [partial_fields]",
"line": 79,
"col": 4
}
}
]
},
"status": 400
}
Partial fields have been removed in 2.0 and now you should use source filtering instead.
Simply replace partial_fields with _source and it should work.

Resources