JDONREFv4 Mappings : Différence entre versions

De JDONREF Wiki
(Le mapping commune)
(Le mapping departement)
Ligne 245 : Ligne 245 :
 
$ curl -XPUT 'http://localhost:9200/jdonref/departement/_mapping' -d '{
 
$ curl -XPUT 'http://localhost:9200/jdonref/departement/_mapping' -d '{
 
"departement": {
 
"departement": {
"path" : "just_name",
 
 
"_type": {"store": true},
 
"_type": {"store": true},
 
"_source": {"excludes": ["geometrie"]},
 
"_source": {"excludes": ["geometrie"]},
 
"properties" : {
 
"properties" : {
"code_departement" : { "type" : "string", "term_vector" : "with_positions_offsets", "index":"not_analyzed", "copy_to": ["codes","fullName"]},
+
"code_departement" : { "type" : "string", "term_vector" : "with_positions_offsets", "index":"not_analyzed", "copy_to": ["codes"]},
"code_pays" : { "type" : "string" , "store" : true, "index":"not_analyzed", "similarity":"jdonrefv3es", "copy_to":"fullName"},
+
"code_pays" : { "type" : "string" , "store" : true, "index":"not_analyzed", "similarity":"jdonrefv3es"},
 
"codes" : { "type" : "string", "store": true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_codes_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
 
"codes" : { "type" : "string", "store": true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_codes_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
 
"pays" : { "type" : "string" , "index": "no"},
 
"pays" : { "type" : "string" , "index": "no"},
Ligne 256 : Ligne 255 :
 
"t1" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
 
"t1" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
 
"ligne6" : { "type" : "string", "store": true, "index": "no"},
 
"ligne6" : { "type" : "string", "store": true, "index": "no"},
"ligne7" : { "type" : "string", "store": true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es", "copy_to":"fullName"},
+
"ligne7" : { "type" : "string", "store": true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
 
"pin" : { "properties" : { "centroide" : { "type" : "geo_point" , "fielddata" : { "format" : "compressed" , "precision" : "1cm"}}}},
 
"pin" : { "properties" : { "centroide" : { "type" : "geo_point" , "fielddata" : { "format" : "compressed" , "precision" : "1cm"}}}},
 
"geometrie" : { "type" : "geo_shape", "precision": "1cm", "tree": "quadtree"},
 
"geometrie" : { "type" : "geo_shape", "precision": "1cm", "tree": "quadtree"},
"fullName" : {"type": "string", "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"}
+
"fullName" : {"type": "string", "term_vector" : "with_positions_offsets_payloads", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"}
}
+
},
  +
"transform" : {
  +
"lang" : "groovy",
  +
"script" : "ctx._source['fullName'] = ''; if (ctx._source['ligne7']!=null) { def tokens = ctx._source['ligne7'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|9'; }; if (ctx._source['code_pays']!=null) { def tokens = ctx._source['code_pays'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|10'; }; if (ctx._source['code_departement']!=null) { def tokens = ctx._source['code_departement'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|8'; };"
  +
}
 
}
 
}
 
}'
 
}'

Version du 15 septembre 2014 à 00:57

JDONREFv3ES introduit différents mapping permettant de gérer des adresses.

C'est le POI ou la Zone qui dispose de la plus grande richesse d'information, mais les autres mappings peuvent disposer d'informations qui leurs sont propres (notamment leur géométrie).

Ils sont fournis dans le plugin sous la forme de fichiers json.

Quelques informations à lire avant de commencer

Les mappings qui suivent disposent de quelques particularités à connaître pour leur bonne lecture.

  • JDONREFv3ES se sert des champs stockés (store:true). Il est important de respecter le nom de ces champs si la requête est utilisée. Les autres sont aussi généralement associés à une adresse mais ne lui sont pas indispensables.
  • Le respect du type est nécessaire pour le bon usage de la requête. Ils permettent un calcul de malus suivant des règles métier associées à chaque type.
  • Le champ 'codes' est un champ calculé à partir d'autres. Il n'est donc pas nécessaire de l'alimenter en donnée, il va les piocher dans code_postal, code_departement, ... L'attribut copyTo est utilisé à cet effet.
  • Le champ 'fullName' est lui aussi calculé à partir de l'ensemble des champs indexés concernant une adresse. Il permet d'effectuer un premier niveau de filtrage rapide sur l'adresse. Il s'appuie sur l'attribut "transform" pour effectuer ce calcul.
  • La plupart des champs ne sont pas stockés dans l'index, mais peuvent toujours être obtenus au travers du champ spécial _source (hormis la géométrie). Cela permet d'alléger le poids de l'index.
  • Le champ géométrie est exclus du champ _source pour éviter de surcharger la base. Les géométries des communes sont particulièrement gourmandes. Leur géométrie n'est donc pas du tout accessible (ni même en spécifiant le champ), mais uniquement utilisée à titre de requêtage spatial (topologique). Par contre, une géométrie "pin" est conservée comme géocodage au centroïde et toujours présent dans le champ _source (et lui aussi requêtable).
  • Les champs qui sont marqués "index":"not_analyzed" peuvent être utilisés dans des requêtes avec des valeurs brutes (ils ne sont pas analyses). Cela semble pertinent pour les codes, les identifiants, tout ce qui n'est pas du langage naturel en somme. Dans un champ comme "ligne4", la distinction ne peux pas ici être réalisée.
  • Vous pouvez bien sûr ajouter autant de champs que vous le souhaitez, construire des requêtes avec, ...
Le mapping poizon

Un POIZON est un POI (point d'intérêt) ou une Zone (géographique). Leur géométrie est différente : un POI est un point, tandis qu'une zone est généralement un polygone (ou multi-polygone). Le type geo_shape est alors employé pour leur géométrie commune. Son mapping est défini de la manière suivante :

 $ curl -XPUT 'http://localhost:9200/jdonref/poizon/_mapping' -d '{
    "poizon": {
       "_type": {"store": true},
       "_source": {"excludes": ["geometrie"]},
       "properties" : {
                         "poizon_id" : { "type" : "string", "index":"not_analyzed"},
                         "adr_id" : { "type" : "string", "index":"not_analyzed"},
                         "tro_id" : { "type" : "string", "index":"not_analyzed"},
                         "voi_id" : { "type" : "string", "index":"not_analyzed"},
                         "code_insee" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                         "code_insee_commune" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                         "code_departement" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                         "code_pays" : { "type" : "string" , "store" : true, "term_vector" : "with_positions_offsets", "index":"not_analyzed", "similarity":"jdonrefv3es"},
                         "codes" : { "type" : "string", "store": true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_codes_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                         "numero" : { "type" : "integer", "index":"not_analyzed"},
                         "repetition" : { "type" : "string", "index":"not_analyzed"},
                         "type_de_voie" : { "type" : "string", "index":"not_analyzed"},
                         "article" : { "type" : "string", "index":"not_analyzed"},
                         "libelle" : { "type" : "string", "index":"not_analyzed"},
                         "commune" : { "type" : "string" , "store":true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                         "code_arrondissement" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                         "code_postal" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                         "pays" : { "type" : "string" , "index": "no"},
                         "t0" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
                         "t1" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
                         "poizon_service" : { "type" : "integer", "index":"not_analyzed"},
                         "ligne1" : { "type" : "string", "store":true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                         "ligne2" : { "type" : "string", "index":"no"},
                         "ligne3" : { "type" : "string", "index":"no"},
                         "ligne4" : { "type" : "string", "store":true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                         "ligne5" : { "type" : "string", "index":"no"},
                         "ligne6" : { "type" : "string", "index": "no"},
                         "ligne7" : { "type" : "string", "store":true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                         "pin" : { "properties" : { "centroide" : { "type" : "geo_point" , "fielddata" : { "format" : "compressed" , "precision" : "1cm"}}}},
                         "geometrie" : { "type" : "geo_shape", "precision": "1cm", "tree": "quadtree"},
                         "fullName" : {"type": "string", "term_vector" : "with_positions_offsets_payloads", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"}
     },
      "transform" : {
          "lang" : "groovy",
          "script" : "ctx._source['fullName'] = ; if (ctx._source['ligne7']!=null) { def tokens = ctx._source['ligne7'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|9'; }; if (ctx._source['code_pays']!=null) { def tokens = ctx._source['code_pays'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|10'; }; if (ctx._source['code_departement']!=null) { def tokens = ctx._source['code_departement'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|8'; }; if ( ctx._source['code_insee']!=null) { def tokens = ctx._source['code_insee'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|7'; }; if (ctx._source['code_insee_commune']!=null) { def tokens = ctx._source['code_insee_commune'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|6'; }; if (ctx._source['commune']!=null) { def tokens = ctx._source['commune'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|5'; }; if (ctx._source['code_arrondissement']!=null) { def tokens = ctx._source['code_arrondissement'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|4'; }; if (ctx._source['code_postal']!=null) { def tokens = ctx._source['code_postal'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|3'; };  if (ctx._source['ligne4']!=null) { def tokens = ctx._source['ligne4'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|2'; }; if (ctx._source['ligne1']!=null) { def tokens = ctx._source['ligne1'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|1'; };"
      }
   }
 }'
Le mapping adresse

Après les type poizon, le type adresse est le plus complet. Sa géométrie est un point, mais pour des raisons pratiques, le type geo_shape est employé. Son mapping est défini de la manière suivante :

 $ curl -XPUT 'http://localhost:9200/jdonref/adresse/_mapping' -d '{
    "adresse": {
       "_type": {"store": true},
       "_source": {"excludes": ["geometrie"]},
       "properties" : {
                           "adr_id" : { "type" : "string", "index":"not_analyzed"},
                           "tro_id" : { "type" : "string", "index":"not_analyzed"},
                           "voi_id" : { "type" : "string", "index":"not_analyzed"},
                           "code_insee" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                           "code_insee_commune" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                           "code_departement" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                           "code_pays" : { "type" : "string" , "store" : true, "term_vector" : "with_positions_offsets", "index":"not_analyzed", "similarity":"jdonrefv3es"},
                           "codes" : { "type" : "string", "store": true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_codes_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                           "numero" : { "type" : "integer", "store": true, "index":"not_analyzed"},
                           "repetition" : { "type" : "string", "index":"not_analyzed"},
                           "type_de_voie" : { "type" : "string", "index":"not_analyzed"},
                           "article" : { "type" : "string", "index":"not_analyzed"},
                           "libelle" : { "type" : "string", "index":"not_analyzed"},
                           "commune" : { "type" : "string" , "store":true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                           "code_arrondissement" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                           "code_postal" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                           "pays" : { "type" : "string" , "index": "no"},
                           "t0" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
                           "t1" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
                           "ligne2" : { "type" : "string", "index":"no"},
                           "ligne3" : { "type" : "string", "index":"no"},
                           "ligne4" : { "type" : "string", "store":true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                           "ligne5" : { "type" : "string", "index":"no"},
                           "ligne6" : { "type" : "string", "index": "no"},
                           "ligne7" : { "type" : "string", "store":true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                           "pin" : { "properties" : { "centroide" : { "type" : "geo_point" , "fielddata" : { "format" : "compressed" , "precision" : "1cm"}}}},
                           "geometrie" : { "type" : "geo_shape", "precision": "1cm", "tree": "quadtree"},
                           "fullName" : {"type": "string", "term_vector" : "with_positions_offsets_payloads", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"}
                       },
      "transform" : {
          "lang" : "groovy",
          "script" : "ctx._source['fullName'] = ; if (ctx._source['ligne7']!=null) { def tokens = ctx._source['ligne7'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|9'; }; if (ctx._source['code_pays']!=null) { def tokens = ctx._source['code_pays'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|10'; }; if (ctx._source['code_departement']!=null) { def tokens = ctx._source['code_departement'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|8'; }; if ( ctx._source['code_insee']!=null) { def tokens = ctx._source['code_insee'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|7'; }; if (ctx._source['code_insee_commune']!=null) { def tokens = ctx._source['code_insee_commune'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|6'; }; if (ctx._source['commune']!=null) { def tokens = ctx._source['commune'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|5'; }; if (ctx._source['code_arrondissement']!=null) { def tokens = ctx._source['code_arrondissement'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|4'; }; if (ctx._source['code_postal']!=null) { def tokens = ctx._source['code_postal'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|3'; };  if (ctx._source['ligne4']!=null) { def tokens = ctx._source['ligne4'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|2'; };"
      }
   }
 }'
Le mapping troncon

Le mapping troncon correspond à une portion de voie. Sa géométrie est une linestring. Il dispose de bornes de début et de fin. Mais contrairement à la base de donnée PostgreSQL de JDONREF, il n'a pas de bornes pour chaque coté du troncon (2 troncons sont créés). Il n'est pas utilisé par la requête mais pourrait l'être ultérieurement pour fournir une interpolation métrique du géocodage. Son mapping est défini de la manière suivante :

 $ curl -XPUT 'http://localhost:9200/jdonref/troncon/_mapping' -d '{
    "troncon": {
       "_type": {"store": true},
       "_source": {"excludes": ["geometrie"]},
       "properties" : {
                           "tro_id" : { "type" : "string", "index":"not_analyzed"},
                           "voi_id" : { "type" : "string", "index":"not_analyzed"},
                           "code_insee" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                           "code_insee_commune" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                           "code_departement" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                           "code_pays" : { "type" : "string" , "store" : true, "term_vector" : "with_positions_offsets", "index":"not_analyzed", "similarity":"jdonrefv3es"},
                           "codes" : { "type" : "string", "store": true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_codes_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                           "numero_debut" : { "type" : "integer", "index":"not_analyzed"},
                           "numero_fin" : { "type" : "integer", "index":"not_analyzed"},
                           "repetition_debut" : { "type" : "string", "index":"not_analyzed"},
                           "repetition_fin" : { "type" : "string", "index":"not_analyzed"},
                           "type_de_voie" : { "type" : "string", "index":"not_analyzed"},
                           "article" : { "type" : "string", "index":"not_analyzed"},
                           "libelle" : { "type" : "string", "index":"not_analyzed"},
                           "commune" : { "type" : "string" , "store":true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                           "code_arrondissement" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                           "code_postal" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                           "pays" : { "type" : "string" , "index": "no"},
                           "t0" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
                           "t1" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
                           "ligne4" : { "type" : "string", "store":true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                           "ligne5" : { "type" : "string",  "index":"no"},
                           "ligne6" : { "type" : "string", "index": "no"},
                           "ligne7" : { "type" : "string", "store":true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                           "pin" : { "properties" : { "centroide" : { "type" : "geo_point" , "fielddata" : { "format" : "compressed" , "precision" : "1cm"}}}},
                           "geometrie" : { "type" : "geo_shape", "precision": "1cm", "tree": "quadtree"},
                           "fullName" : {"type": "string", "term_vector" : "with_positions_offsets_payloads", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"}
                       },
      "transform" : {
          "lang" : "groovy",
          "script" : "ctx._source['fullName'] = ; if (ctx._source['ligne7']!=null) { def tokens = ctx._source['ligne7'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|9'; }; if (ctx._source['code_pays']!=null) { def tokens = ctx._source['code_pays'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|10'; }; if (ctx._source['code_departement']!=null) { def tokens = ctx._source['code_departement'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|8'; }; if ( ctx._source['code_insee']!=null) { def tokens = ctx._source['code_insee'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|7'; }; if (ctx._source['code_insee_commune']!=null) { def tokens = ctx._source['code_insee_commune'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|6'; }; if (ctx._source['commune']!=null) { def tokens = ctx._source['commune'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|5'; }; if (ctx._source['code_arrondissement']!=null) { def tokens = ctx._source['code_arrondissement'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|4'; }; if (ctx._source['code_postal']!=null) { def tokens = ctx._source['code_postal'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|3'; };  if (ctx._source['ligne4']!=null) { def tokens = ctx._source['ligne4'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|2'; };"
      }
   }
 }'
Le mapping voie

Le mapping voie correspond à une adresse sans numéro. Sa géométrie est une linestring (en attendant l'implémentation du multilinestring par elasticsearch). Elle dispose d'un numéro de début et de fin. Son mapping est défini de la manière suivante :

 $ curl -XPUT 'http://localhost:9200/jdonref/voie/_mapping' -d '{
    "voie": {
       "_type": {"store": true},
      "_source": {"excludes": ["geometrie"]},
      "properties" : {
                           "voi_id" : { "type" : "string", "index":"not_analyzed"},
                           "code_insee" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                           "code_insee_commune" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                           "code_departement" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                           "code_pays" : { "type" : "string" , "store" : true, "term_vector" : "with_positions_offsets", "index":"not_analyzed", "similarity":"jdonrefv3es"},
                           "codes" : { "type" : "string", "store": true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_codes_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                           "numero_min" : { "type" : "integer", "index":"not_analyzed"},
                           "numero_max" : { "type" : "integer", "index":"not_analyzed"},
                           "type_de_voie" : { "type" : "string", "index":"not_analyzed"},
                           "article" : { "type" : "string", "index":"not_analyzed"},
                           "libelle" : { "type" : "string", "index":"not_analyzed"},
                           "commune" : { "type" : "string" , "store":true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                           "code_arrondissement" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes","fullName"]},
                           "code_postal" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes","fullName"]},
                           "pays" : { "type" : "string" , "index": "no"},
                           "t0" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
                           "t1" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
                           "ligne4" : { "type" : "string", "store":true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                           "ligne5" : { "type" : "string",  "index":"no"},
                           "ligne6" : { "type" : "string", "index": "no"},
                           "ligne7" : { "type" : "string", "store":true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                           "pin" : { "properties" : { "centroide" : { "type" : "geo_point" , "fielddata" : { "format" : "compressed" , "precision" : "1cm"}}}},
                           "geometrie" : { "type" : "geo_shape", "precision": "1cm", "tree": "quadtree"},
                           "fullName" : {"type": "string", "term_vector" : "with_positions_offsets_payloads", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"}
                       },
      "transform" : {
          "lang" : "groovy",
          "script" : "ctx._source['fullName'] = ; if (ctx._source['ligne7']!=null) { def tokens = ctx._source['ligne7'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|9'; }; if (ctx._source['code_pays']!=null) { def tokens = ctx._source['code_pays'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|10'; }; if (ctx._source['code_departement']!=null) { def tokens = ctx._source['code_departement'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|8'; }; if ( ctx._source['code_insee']!=null) { def tokens = ctx._source['code_insee'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|7'; }; if (ctx._source['code_insee_commune']!=null) { def tokens = ctx._source['code_insee_commune'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|6'; }; if (ctx._source['commune']!=null) { def tokens = ctx._source['commune'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|5'; }; if (ctx._source['code_arrondissement']!=null) { def tokens = ctx._source['code_arrondissement'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|4'; }; if (ctx._source['code_postal']!=null) { def tokens = ctx._source['code_postal'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|3'; };  if (ctx._source['ligne4']!=null) { def tokens = ctx._source['ligne4'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|2'; };"
      }
  }
}'
Le mapping commune

Le mapping commune a pour géométrie un multipolygon, sans extrusion. Son mapping est défini de la manière suivante :

 $ curl -XPUT 'http://localhost:9200/jdonref/commune/_mapping' -d '{
    "commune": {
       "_type": {"store": true},
       "_source": {"excludes": ["geometrie"]},
       "properties" : {     
                         "code_insee" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                         "code_departement" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                         "code_insee_commune" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                         "code_pays" : { "type" : "string" , "store" : true, "term_vector" : "with_positions_offsets", "index":"not_analyzed", "similarity":"jdonrefv3es"},
                         "commune" : { "type" : "string" , "store":true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                         "code_arrondissement" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                         "code_postal" : { "type" : "string", "index":"not_analyzed", "copy_to": ["codes"]},
                         "codes" : { "type" : "string", "store": true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_codes_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                         "pays" : { "type" : "string" , "index": "no"},
                         "t0" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
                         "t1" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
                         "ligne5" : { "type" : "string", "index":"no"},
                         "ligne6" : { "type" : "string", "index": "no"},
                         "ligne7" : { "type" : "string", "store": true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                         "pin" : { "properties" : { "centroide" : { "type" : "geo_point" , "fielddata" : { "format" : "compressed" , "precision" : "1cm"}}}},
                         "geometrie" : { "type" : "geo_shape", "precision": "1cm", "tree": "quadtree"},
                         "fullName" : {"type": "string", "term_vector" : "with_positions_offsets_payloads", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"}
                       },
      "transform" : {
          "lang" : "groovy",
          "script" : "ctx._source['fullName'] = ; if (ctx._source['ligne7']!=null) { def tokens = ctx._source['ligne7'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|9'; }; if (ctx._source['code_pays']!=null) { def tokens = ctx._source['code_pays'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|10'; }; if (ctx._source['code_departement']!=null) { def tokens = ctx._source['code_departement'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|8'; }; if ( ctx._source['code_insee']!=null) { def tokens = ctx._source['code_insee'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|7'; }; if (ctx._source['code_insee_commune']!=null) { def tokens = ctx._source['code_insee_commune'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|6'; }; if (ctx._source['commune']!=null) { def tokens = ctx._source['commune'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|5'; }; if (ctx._source['code_arrondissement']!=null) { def tokens = ctx._source['code_arrondissement'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|4'; }; if (ctx._source['code_postal']!=null) { def tokens = ctx._source['code_postal'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|3'; };"
      }
   }'
Le mapping departement

Le mapping commune a pour géométrie un multipolygon, sans extrusion. Son mapping est défini de la manière suivante :

 $ curl -XPUT 'http://localhost:9200/jdonref/departement/_mapping' -d '{
    "departement": {
       "_type": {"store": true},
       "_source": {"excludes": ["geometrie"]},
       "properties" : {
                           "code_departement" : { "type" : "string", "term_vector" : "with_positions_offsets", "index":"not_analyzed", "copy_to": ["codes"]},
                           "code_pays" : { "type" : "string" , "store" : true, "index":"not_analyzed", "similarity":"jdonrefv3es"},
                           "codes" : { "type" : "string", "store": true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_codes_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                           "pays" : { "type" : "string" , "index": "no"},
                           "t0" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
                           "t1" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
                           "ligne6" : { "type" : "string", "store": true, "index": "no"},
                           "ligne7" : { "type" : "string", "store": true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"},
                           "pin" : { "properties" : { "centroide" : { "type" : "geo_point" , "fielddata" : { "format" : "compressed" , "precision" : "1cm"}}}},
                           "geometrie" : { "type" : "geo_shape", "precision": "1cm", "tree": "quadtree"},
                           "fullName" : {"type": "string", "term_vector" : "with_positions_offsets_payloads", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"}
                       },
      "transform" : {
          "lang" : "groovy",
          "script" : "ctx._source['fullName'] = ; if (ctx._source['ligne7']!=null) { def tokens = ctx._source['ligne7'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|9'; }; if (ctx._source['code_pays']!=null) { def tokens = ctx._source['code_pays'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|10'; }; if (ctx._source['code_departement']!=null) { def tokens = ctx._source['code_departement'].split(' '); for(x in tokens) ctx._source['fullName'] += ' ' + x + '|8'; };"
      }
   }
 }'
Le mapping pays

Le mapping pays a pour géométrie un multipolygon, sans extrusion. Son mapping est défini de la manière suivante :

 $ curl -XPUT 'http://localhost:9200/jdonref/pays/_mapping' -d '{
    "pays": {
      "path" : "just_name",
       "_type": {"store": true},
      "_source": {"excludes": ["geometrie"]},
      "properties" : { 
                           "code_pays" : { "type" : "string" , "store" : true, "term_vector" : "with_positions_offsets", "index":"not_analyzed", "similarity":"jdonrefv3es", "copy_to":"fullName"},
                           "pays" : { "type" : "string" , "index": "no"},
                           "t0" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
                           "t1" : { "type" : "date", "format": "YYYY-MM-dd HH:mm:ss", "index":"not_analyzed"},
                           "ligne7" : { "type" : "string", "store": true, "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es", "copy_to":"fullName"},
                           "pin" : { "properties" : { "centroide" : { "type" : "geo_point" , "fielddata" : { "format" : "compressed" , "precision" : "1cm"}}}},
                           "geometrie" : { "type" : "geo_shape", "precision": "1cm", "tree": "quadtree"},
                           "fullName" : {"type": "string", "term_vector" : "with_positions_offsets", "index_analyzer":"jdonrefv3es_index","search_analyzer":"jdonrefv3es_search", "similarity":"jdonrefv3es"}
                       }
  }
 }'