Hi,
my data source is as follows (API json)
{
"bookings": [
{
"bookingId": 553267,
"bookingRef": "VO20200108460",
"statusId": 1,
"status": "Confirmed",
"createdDate": "2020-01-06 00:00:00",
"confirmedDate": "",
"hotelId": 17060,
"hotelName": "Nerolia Hotel & SPA 4*",
"hotelCity": "Monastir",
"hotelCountry": "Tunisie",
"hotelAddress": "Zone Touristique Dkhila Skanes,Monastir",
"hotelPhone": 73275420,
"arrDate": "2020-01-03",
"depDate": "2020-01-05",
"price": 0,
"currency": "",
"purchasePrice": 0,
"cancelDeadline": "",
"partnerId": 10361,
}]}
my problem :
when I consulted my data in discover I have for example( "bookingId":553,267)or( "hotelId" : 17060)
what can i do tho have the correct datatype ("bookingId":553267)!!!!!
my config file:
input {
http_poller {
urls => {
url => "xxx"
}
request_timeout => 60
schedule => { every => "60s" }
codec => "json"
}
}
filter {
split { field => "[bookings]" }
split { field => "[bookings][rooms]" }
mutate {
rename => {
"[bookings][bookingId]" => "bookingId"
"[bookings][confirmedDate]" => "confirmedDate"
"[bookings][status]" => "status"
"[bookings][hotelId]" => "hotelId"
"[bookings][hotelName]" => "hotelName"
"[bookings][hotelCity]" => "hotelCity"
"[bookings][hotelCountry]" => "hotelCountry"
"[bookings][arrDate]" => "arrDate"
"[bookings][depDate]" => "depDate"
"[bookings][price]" => "price"
"[bookings][currency]" => "currency"
"[bookings][purchasePrice]" => "purchasePrice"
"[bookings][partnerName]" => "partnerName"
"[bookings][partnerId]" => "partnerId"
"[bookings][firstName]" => "firstName"
"[bookings][lastName]" => "lastName"
"[bookings][channel]" => "channel"
"[bookings][supplierName]" => "supplierName"
"[bookings][rooms][board]" => "board"
"[bookings][rooms][paxes][adults]" => "adults"
"[bookings][rooms][paxes][infant]" => "infant"
"[bookings][rooms][paxes][children]" => "children"
"[bookings][rooms][quantity]" => "quantity"
"[bookings][rooms][room]" => "room"
}
convert => {
"bookingId" => "integer"
"hotelId" => "integer"
"partnerId" => "integer"
"adults" => "integer"
"infant" => "integer"
"children" => "integer"
"quantity" => "integer"
}
remove_field => ["bookingRef", "bookings", "createdDate", "hotelAddress", "hotelPhonearrDate", "customerId", "title", "email", "city", "mobile", "supplierId","paxe", "payments", "options", "isXML"]
}
}
output {
elasticsearch {
hosts => "localhost:9200"
index => "bookings"
action => "update"
doc_as_upsert => "true"
document_id => "%{bookingId}"
}
stdout { codec => rubydebug }
}