У меня возникли проблемы с получением определенных полей из-за неправильных типов полей. Я создал класс документа, который
Код: Выделить всё
@Document(indexName = "netstat*")
@Setting(settingPath = "static/es-settings.json")
public class NetworkStats {
@Id
@Field(type = FieldType.Keyword)
private String id;
@Field
private String timeStamp ;
@Field(type = FieldType.Text)
private String podName ;
@Field(type = FieldType.Text)
private String iporHost ;
@Field(type = FieldType.Auto)
private String connectionCount ;
@Field(type = FieldType.Text)
private String command ;
}
Пример данных из ElasticSearch ниже
Код: Выделить всё
{
"_index": "netstat-2021.11.09",
"_type": "_doc",
"_id": "0sJmA30BW7LXXVrK0nCg",
"_score": 1.0,
"_source": {
"podname": "logindeployment-5479f7-4f2qr",
"input": {
"type": "log"
},
"iporhost": "6200",
"tags": [],
"command": "OUTESTAB",
"agent": {
"version": "7.15.1",
"id": "e8feeb4e-1f9e-41b2-bcba-38e507d176db",
"type": "filebeat",
"hostname": "BL1726L",
"name": "BL1726L",
"ephemeral_id": "c2859ece-3e95-4204-909d-af59322b9fa2"
},
"timestamp": "05-10-21T13:17:25.014719626",
"ecs": {
"version": "1.11.0"
},
"connectionscount": "2",
"@timestamp": "2021-11-09T06:31:29.104Z",
"log": {
"offset": 1002,
"file": {
"path": "D:\\elastic_stack\\data\\log\\netStats.log"
}
}
}
},
Подробнее здесь: https://stackoverflow.com/questions/698 ... ava-fields