In [1]:
import json
import elasticsearch
from elasticsearch import Elasticsearch
es_server = 'http://search-01.ec2.internal:9200/'
indice = 'schiefjm_sng_logs'
es = Elasticsearch([es_server])
es
Out[1]:
In [58]:
create_body = json.dumps({
"mappings": {
"log_entry": {
"properties": {
"data": {
"properties": {
"point": { "type": "geo_point" },
"RSV_IP_ADDRESS": { "type": "ip", "store": "true" },
"destIP": { "type": "ip", "store": "true" },
"BBOX_WKT": { "type": "geo_shape" },
"BBOX_WKT2": { "type": "geo_shape" }
}
}
}
}
}
})
es.indices.delete(index=indice)
es.indices.create(index=indice, body=create_body)
Out[58]:
In [59]:
es.indices.get_mapping(indice)
Out[59]:
In [27]:
es.index(index=indice, doc_type="log_entry", body=body)
Out[27]:
In [ ]: