Uploaded image for project: 'Elasticsearch'
  1. Elasticsearch
  2. ELASTIC-18

NullPointerException in ServerProfileBuilder when creating index without datasource field maping

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Neutral
    • None
    • 1.0.0
    • None
    • Java 11, Magnolia 6.2.15

    Description

      The Index Editor app - tab datasource does not require a link to a field mapping. However, if it is missing the index creation fails with a NullPointerException. Furthermore the ES server fails creating an index if an empty list of mapping fields is sent.

       

      Workaround:

      Patch method 

      buildMappingsFromJcr() of ServerProfileBuilder:

      private Map<String, MappingProperties> buildMappingsFromJcr() throws ElasticConfigurationException {
          Map<String, MappingProperties> indexProperties = new HashMap<>();
          if (this.index.getDatasource().getMappedField() != null) {
              MappingProperties properties = new MappingProperties();
              Map<String, TypeSpecification> fieldSpecification = new HashMap<>();
      
              for (MappingFieldItemConfiguration field : this.index.getDatasource().getMappedField().getFields()) {
                  fieldSpecification.put(field.getName(), this.buildSpecification(field));
              }
              if (!fieldSpecification.isEmpty()) {
                  properties.setProperties(fieldSpecification);
                  indexProperties.put(this.index.getIndexType(), properties);
              }
          }
          return indexProperties;
      } 

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              wolf.bubenik wolf bubenik
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Checklists

                  Bug DoR
                  Task DoD