@@ -32,22 +32,82 @@ class TransactionsClient(BaseTransactionsClient):
3232 settings = ElasticsearchSettings ()
3333 client = settings .create_client
3434
35- mappings = {
35+ ES_MAPPINGS_DYNAMIC_TEMPLATES = [
36+ # Common https://github.com/radiantearth/stac-spec/blob/master/item-spec/common-metadata.md
37+ {
38+ "descriptions" : {
39+ "match_mapping_type" : "string" ,
40+ "match" : "description" ,
41+ "mapping" : {"type" : "text" },
42+ }
43+ },
44+ {
45+ "titles" : {
46+ "match_mapping_type" : "string" ,
47+ "match" : "title" ,
48+ "mapping" : {"type" : "text" },
49+ }
50+ },
51+ # Projection Extension https://github.com/stac-extensions/projection
52+ {"proj_epsg" : {"match" : "proj:epsg" , "mapping" : {"type" : "integer" }}},
53+ {
54+ "proj_projjson" : {
55+ "match" : "proj:projjson" ,
56+ "mapping" : {"type" : "object" , "enabled" : False },
57+ }
58+ },
59+ {
60+ "proj_centroid" : {
61+ "match" : "proj:centroid" ,
62+ "mapping" : {"type" : "geo_point" },
63+ }
64+ },
65+ {
66+ "proj_geometry" : {
67+ "match" : "proj:geometry" ,
68+ "mapping" : {"type" : "geo_shape" },
69+ }
70+ },
71+ {
72+ "no_index_href" : {
73+ "match" : "href" ,
74+ "mapping" : {"type" : "text" , "index" : False },
75+ }
76+ },
77+ # Default all other strings not otherwise specified to keyword
78+ {"strings" : {"match_mapping_type" : "string" , "mapping" : {"type" : "keyword" }}},
79+ {"numerics" : {"match_mapping_type" : "long" , "mapping" : {"type" : "float" }}},
80+ ]
81+
82+ ES_MAPPINGS = {
83+ "numeric_detection" : False ,
84+ "dynamic_templates" : ES_MAPPINGS_DYNAMIC_TEMPLATES ,
3685 "properties" : {
3786 "geometry" : {"type" : "geo_shape" },
38- "id" : {"type" : "text" , "fields" : {"keyword" : {"type" : "keyword" }}},
39- "properties__datetime" : {
40- "type" : "text" ,
41- "fields" : {"keyword" : {"type" : "keyword" }},
87+ "assets" : {"type" : "object" , "enabled" : False },
88+ "links" : {"type" : "object" , "enabled" : False },
89+ "properties" : {
90+ "type" : "object" ,
91+ "properties" : {
92+ # Common https://github.com/radiantearth/stac-spec/blob/master/item-spec/common-metadata.md
93+ "datetime" : {"type" : "date" },
94+ "start_datetime" : {"type" : "date" },
95+ "end_datetime" : {"type" : "date" },
96+ "created" : {"type" : "date" },
97+ "updated" : {"type" : "date" },
98+ # Satellite Extension https://github.com/stac-extensions/sat
99+ "sat:absolute_orbit" : {"type" : "integer" },
100+ "sat:relative_orbit" : {"type" : "integer" },
101+ },
42102 },
43- }
103+ },
44104 }
45105
46106 def create_item_index (self ):
47107 """Create the index for Items."""
48108 self .client .indices .create (
49109 index = "stac_items" ,
50- body = {"mappings" : self .mappings },
110+ body = {"mappings" : self .ES_MAPPINGS },
51111 ignore = 400 , # ignore 400 already exists code
52112 )
53113
0 commit comments