2016-08-09 12 views
0

Ich habe ein Schema erstellt und dann Inhalte hinzugefügt. Sobald ich den Inhalt hinzufüge, wird das Schema dupliziert. Ich habe auch Kibana oben auf der Suche. Ich bin nicht in der Lage herauszufinden, warum dies geschieht. Die Daten in Kibana zeigen sich richtig, aber ich bin besorgt, dass dies in der Zukunft zu Problemen führen könnte. Bitte helfen Sie.ElasticSearch-Indexschema wird nach dem Hinzufügen des Inhalts geändert

Mein Schema

{ 
    "properties": { 
     "ansible_fqdn": { "type": "string" }, 
     "ansible_hostname": { "type": "string" }, 
     "ansible_architecture": { "type": "string" }, 
     "ansible_distribution": { "type": "string" }, 
     "ansible_distribution_version": { "type": "string" }, 
     "ansible_os_family": { "type": "string" }, 
     "facter_ipaddress": { "type": "string" }, 
     "facter_kernelrelease": { "type": "string" }, 
     "facter_memorysize": { "type": "string" }, 
     "facter_physicalprocessorcount": { "type": "integer" }, 
     "facter_timezone": { "type": "string" }, 
     "facter_virtual": { "type": "string" }, 
     "primary_service_name": { "type": "string" }, 
     "pp_name": { "type": "string" }, 
     "wg_project_name": { "type": "string" }, 
     "primary_app_name": { "type": "string" }, 
     "location": { "type": "string" }, 
     "status": { "type": "string" }, 
     "pp_idx": { "type": "string" } 
    } 
} 

Schema Beitrag Hinzufügen von Inhalten

{ 
    "systeminformation" : { 
    "aliases" : { }, 
    "mappings" : { 
     "ansible_facts" : { 
     "properties" : { 
      "ansible_architecture" : { 
      "type" : "string" 
      }, 
      "ansible_distribution" : { 
      "type" : "string" 
      }, 
      "ansible_distribution_version" : { 
      "type" : "string" 
      }, 
      "ansible_facts" : { 
      "properties" : { 
       "ansible_architecture" : { 
       "type" : "string" 
       }, 
       "ansible_distribution" : { 
       "type" : "string" 
       }, 
       "ansible_distribution_version" : { 
       "type" : "string" 
       }, 
       "ansible_fqdn" : { 
       "type" : "string" 
       }, 
       "ansible_hostname" : { 
       "type" : "string" 
       }, 
       "ansible_os_family" : { 
       "type" : "string" 
       }, 
       "facter_ipaddress" : { 
       "type" : "string" 
       }, 
       "facter_kernelrelease" : { 
       "type" : "string" 
       }, 
       "facter_memorysize" : { 
       "type" : "string" 
       }, 
       "facter_physicalprocessorcount" : { 
       "type" : "long" 
       }, 
       "facter_timezone" : { 
       "type" : "string" 
       }, 
       "facter_virtual" : { 
       "type" : "string" 
       }, 
       "status" : { 
       "type" : "string" 
       }, 
       "location" : { 
       "type" : "string" 
       }, 
       "pp_id" : { 
       "type" : "string" 
       }, 
       "pp_name" : { 
       "type" : "string" 
       }, 
       "primary_app_name" : { 
       "type" : "string" 
       }, 
       "primary_service_name" : { 
       "type" : "string" 
       }, 
       "wg_project_name" : { 
       "type" : "string" 
       } 
      } 
      }, 
      "ansible_fqdn" : { 
      "type" : "string" 
      }, 
      "ansible_hostname" : { 
      "type" : "string" 
      }, 
      "ansible_os_family" : { 
      "type" : "string" 
      }, 
      "facter_ipaddress" : { 
      "type" : "string" 
      }, 
      "facter_kernelrelease" : { 
      "type" : "string" 
      }, 
      "facter_memorysize" : { 
      "type" : "string" 
      }, 
      "facter_physicalprocessorcount" : { 
      "type" : "string" 
      }, 
      "facter_timezone" : { 
      "type" : "string" 
      }, 
      "facter_virtual" : { 
      "type" : "string" 
      }, 
      "status" : { 
      "type" : "string" 
      }, 
      "location" : { 
      "type" : "string" 
      }, 
      "pp_idx" : { 
      "type" : "string" 
      }, 
      "pp_name" : { 
      "type" : "string" 
      }, 
      "primary_app_name" : { 
      "type" : "string" 
      }, 
      "primary_service_name" : { 
      "type" : "string" 
      }, 
      "wg_project_name" : { 
      "type" : "string" 
      } 
     } 
     } 
    }, 
    "settings" : { 
     "index" : { 
     "creation_date" : "1470748490174", 
     "uuid" : "r9Een_BXSf2cR3Cl2kb2Jg", 
     "number_of_replicas" : "1", 
     "number_of_shards" : "5", 
     "version" : { 
      "created" : "2030499" 
     } 
     } 
    }, 
    "warmers" : { } 
    } 
} 

Inhalte, die

{"ansible_facts": {"ansible_fqdn": "hostname.domain.com", "ansible_hostname": "hostname", "ansible_architecture": "x86_64", "ansible_distribution": "OracleLinux", "ansible_distribution_version": "6", "ansible_os_family": "RedHat", "facter_ipaddress": "10.10.10.10", "facter_kernelrelease": "2.6", "facter_memorysize": "16 GB", "facter_physicalprocessorcount": 2, "facter_timezone": "UTC", "facter_virtual": "vmware", "primary_service_name": "Something", "pp_name": "abc", "wg_project_name": "something", "primary_app_name": "something", "location": "", "status": "use", "pp_id": "P"}} 
+0

Kann es passieren, dass Sie versehentlich verschiedene Objekte an Elasticsearch gesendet haben? Wenn Sie Ihren aktuellen Index löschen und dann erneut Daten senden, beobachten Sie das gleiche Verhalten? – oldbam

+0

Welchen vollständigen Indexierungsbefehl verwenden Sie? –

+0

Für mich sieht es so aus, als hättest du 'POST/mein_index/ansible_facts/12345 {" ansible_facts ": {" ansible_fqdn ": ....}} während du es hättest tun sollen wie' POST/my_index/ansible_facts/12345 {" ansible_fqdn ": ....}' –

Antwort

0

Für mich hinzugefügt wird es sieht aus wie Sie POST /my_index/ansible_facts/12345 {"ansible_facts": {"ansible_fqdn":....}} tat, während Sie es getan haben sollte wie POST /my_index/ansible_facts/12345 {"ansible_fqdn":....}.

Der Typname (ansible_facts) ist sowohl in der URL des Befehls als auch im Rumpf des Befehls enthalten. Und the mapping itself is very flexible and is schema-free, was bedeutet, dass Elasticsearch Felder für neue Daten im Dokument erstellt, wenn nicht anders in Ihrem eigenen Mapping erwähnt. Und Ihr Fehler aus dem Befehl erstellt ein neues Feld - ansible_facts - mit Unterfeldern darin. Also, technisch ist das Mapping nicht dupliziert (das ist nicht möglich mit ES), es hat ein neues Feld hinzugefügt, ein Feld mit vielen Unterfeldern.

Verwandte Themen