我正在编写一个简单的应用程序,该程序通过Kafka Consumer将数据存储到Elasticsearch中。我的问题是,每当我执行同一个消费者应用程序时,它在处理40或50条记录后都会引发异常。异常描述说总字段数的限制已超出索引(1000)。我了解到,Elasticsearch中的默认值(条目)为1000,但就我而言,它远低于1000。
我在下面添加异常(exception),在此先感谢您的帮助或建议! Suppressed: org.elasticsearch.client.ResponseException: method [POST], host [https://kafka-poject-twitter-8210391326.eu-west-1.bonsaisearch.net:443], URI [/twitter/tweets?timeout=1m], status line [HTTP/1.1 400 Bad Request] {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Limit of total fields [1000] in index [twitter] has been exceeded"}],"type":"illegal_argument_exception","reason":"Limit of total fields [1000] in index [twitter] has been exceeded"},"status":400} at org.elasticsearch.client.RestClient$SyncResponseListener.get(RestClient.java:920) at org.elasticsearch.client.RestClient.performRequest(RestClient.java:227) at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1256)
最佳答案
主要原因-Limit of total fields [1000] in index [twitter] has been exceeded
您可以通过增加限制来克服这个问题
PUT twitter/_settings
{
"index.mapping.total_fields.limit": 2000
}
关于java - Elasticsearch中的49条记录后发生异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62517410/