test_class.file: oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticIndexHelperTest.java
test_class.identifier: ElasticIndexHelperTest
test_case.body: @Test
      public void spellCheck() throws IOException {
          IndexDefinitionBuilder builder = new ElasticIndexDefinitionBuilder();
          IndexDefinitionBuilder.IndexRule indexRule = builder.indexRule("type");
          indexRule.property("foo").type("String").analyzed().useInSpellcheck();
          indexRule.property("bar").type("String").analyzed();
  
          NodeState nodeState = builder.build();
  
          ElasticIndexDefinition definition =
                  new ElasticIndexDefinition(nodeState, nodeState, "path", "prefix");
  
          CreateIndexRequest request = ElasticIndexHelper.createIndexRequest(ElasticIndexNameHelper.getRemoteIndexName(definition), definition);
  
          assertThat(request.settings().get("analysis.filter.shingle.type"), is("shingle"));
          assertThat(request.settings().get("analysis.analyzer.trigram.type"), is("custom"));
  
          ObjectMapper mapper = new ObjectMapper();
          Map<String, Object> jsonMappings = mapper.readValue(request.mappings().streamInput(), Map.class);
          Map fooMapping = (Map) ((Map) jsonMappings.get("properties")).get("foo");
          Map fooFields = (Map) fooMapping.get("fields");
          assertThat(fooFields.get("trigram"), notNullValue());
          Map barMapping = (Map) ((Map) jsonMappings.get("properties")).get("bar");
          Map barFields = (Map) barMapping.get("fields");
          assertThat(barFields.get("trigram"), nullValue());
      }
test_case.class_method_signature: ElasticIndexHelperTest.spellCheck()
test_case.full_signature: @Test public void spellCheck()
test_case.identifier: spellCheck
test_case.invocations: indexRule useInSpellcheck analyzed type property analyzed type property build createIndexRequest getRemoteIndexName assertThat get settings is assertThat get settings is readValue streamInput mappings get get get assertThat get notNullValue get get get assertThat get nullValue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void spellCheck()
focal_class.file: oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticIndexHelper.java
focal_class.identifier: ElasticIndexHelper
focal_class.class_method_signature: ElasticIndexHelper.createIndexRequest(String remoteIndexName, ElasticIndexDefinition indexDefinition)
focal_class.full_signature: public static CreateIndexRequest createIndexRequest(String remoteIndexName, ElasticIndexDefinition indexDefinition)
focal_class.identifier: createIndexRequest
focal_class.modifiers: public static
focal_class.parameters: (String remoteIndexName, ElasticIndexDefinition indexDefinition)
focal_class.return: CreateIndexRequest
focal_class.signature: CreateIndexRequest createIndexRequest(String remoteIndexName, ElasticIndexDefinition indexDefinition)
focal_class.class_method_signature: ElasticIndexHelper.loadSettings(ElasticIndexDefinition indexDefinition)
focal_class.full_signature: private static XContentBuilder loadSettings(ElasticIndexDefinition indexDefinition)
focal_class.identifier: loadSettings
focal_class.modifiers: private static
focal_class.parameters: (ElasticIndexDefinition indexDefinition)
focal_class.return: XContentBuilder
focal_class.signature: XContentBuilder loadSettings(ElasticIndexDefinition indexDefinition)
focal_class.class_method_signature: ElasticIndexHelper.mapInternalProperties(XContentBuilder mappingBuilder)
focal_class.full_signature: private static void mapInternalProperties(XContentBuilder mappingBuilder)
focal_class.identifier: mapInternalProperties
focal_class.modifiers: private static
focal_class.parameters: (XContentBuilder mappingBuilder)
focal_class.return: void
focal_class.signature: void mapInternalProperties(XContentBuilder mappingBuilder)
focal_class.class_method_signature: ElasticIndexHelper.mapIndexRules(ElasticIndexDefinition indexDefinition, XContentBuilder mappingBuilder)
focal_class.full_signature: private static void mapIndexRules(ElasticIndexDefinition indexDefinition, XContentBuilder mappingBuilder)
focal_class.identifier: mapIndexRules
focal_class.modifiers: private static
focal_class.parameters: (ElasticIndexDefinition indexDefinition, XContentBuilder mappingBuilder)
focal_class.return: void
focal_class.signature: void mapIndexRules(ElasticIndexDefinition indexDefinition, XContentBuilder mappingBuilder)
focal_class.class_method_signature: ElasticIndexHelper.checkIndexRules(ElasticIndexDefinition indexDefinition)
focal_class.full_signature: private static void checkIndexRules(ElasticIndexDefinition indexDefinition)
focal_class.identifier: checkIndexRules
focal_class.modifiers: private static
focal_class.parameters: (ElasticIndexDefinition indexDefinition)
focal_class.return: void
focal_class.signature: void checkIndexRules(ElasticIndexDefinition indexDefinition)
focal_method.body: public static CreateIndexRequest createIndexRequest(String remoteIndexName, ElasticIndexDefinition indexDefinition) throws IOException {
          final CreateIndexRequest request = new CreateIndexRequest(remoteIndexName);
  
          // provision settings
          request.settings(loadSettings(indexDefinition));
  
          // provision mappings
          final XContentBuilder mappingBuilder = XContentFactory.jsonBuilder();
          mappingBuilder.startObject();
          {
              mappingBuilder.startObject("properties");
              {
                  mapInternalProperties(mappingBuilder);
                  mapIndexRules(indexDefinition, mappingBuilder);
              }
              mappingBuilder.endObject();
          }
          mappingBuilder.endObject();
          request.mapping(mappingBuilder);
  
          return request;
      }
focal_method.class_method_signature: ElasticIndexHelper.createIndexRequest(String remoteIndexName, ElasticIndexDefinition indexDefinition)
focal_method.full_signature: public static CreateIndexRequest createIndexRequest(String remoteIndexName, ElasticIndexDefinition indexDefinition)
focal_method.identifier: createIndexRequest
focal_method.invocations: settings loadSettings jsonBuilder startObject startObject mapInternalProperties mapIndexRules endObject endObject mapping
focal_method.modifiers: public static
focal_method.parameters: (String remoteIndexName, ElasticIndexDefinition indexDefinition)
focal_method.return: CreateIndexRequest
focal_method.signature: CreateIndexRequest createIndexRequest(String remoteIndexName, ElasticIndexDefinition indexDefinition)