Examples of ElasticSearchFieldAttributes


Examples of com.sematext.searchschemer.index.elasticsearch.ElasticSearchFieldAttributes

public class ElasticsearchStructureWriterTest extends TestCase {
  @Test
  public void testWriteNonDynamic() throws Exception {
    IndexStructure structure = new BasicIndexStructure();
    structure.addField("cat", new ElasticSearchFieldAttributes("cat", "string", "yes", "analyzed"), false);

    StringWriter writer = new StringWriter();
    ElasticsearchIndexStructureWriter indexWriter = new ElasticsearchIndexStructureWriter();
    indexWriter.write(structure, writer);
View Full Code Here

Examples of com.sematext.searchschemer.index.elasticsearch.ElasticSearchFieldAttributes

  }

  @Test
  public void testWriteMultipleNonDynamic() throws Exception {
    IndexStructure structure = new BasicIndexStructure();
    structure.addField("cat", new ElasticSearchFieldAttributes("cat", "string", "yes", "analyzed"), false);
    structure.addField("menu", new ElasticSearchFieldAttributes("menu", "string", "yes", "no"), false);

    StringWriter writer = new StringWriter();
    ElasticsearchIndexStructureWriter indexWriter = new ElasticsearchIndexStructureWriter();
    indexWriter.write(structure, writer);
View Full Code Here

Examples of com.sematext.searchschemer.index.elasticsearch.ElasticSearchFieldAttributes

  }

  @Test
  public void testWriteDynamic() throws Exception {
    IndexStructure structure = new BasicIndexStructure();
    structure.addField("*_string", new ElasticSearchFieldAttributes("*_string", "string", "yes", "no"), true);

    StringWriter writer = new StringWriter();
    ElasticsearchIndexStructureWriter indexWriter = new ElasticsearchIndexStructureWriter();
    indexWriter.write(structure, writer);

View Full Code Here

Examples of com.sematext.searchschemer.index.elasticsearch.ElasticSearchFieldAttributes

  }

  @Test
  public void testWriteNonDynamicWithAdditionalAttributes() throws Exception {
    IndexStructure structure = new BasicIndexStructure();
    ElasticSearchFieldAttributes field = new ElasticSearchFieldAttributes("cat", "string", "yes", "analyzed");
    field.setOmitNorms(true);
    field.setOmitTermFreqAndPositions(true);
    field.setBoost(2.0f);
    structure.addField("cat", field, false);

    StringWriter writer = new StringWriter();
    ElasticsearchIndexStructureWriter indexWriter = new ElasticsearchIndexStructureWriter();
    indexWriter.write(structure, writer);
View Full Code Here

Examples of com.sematext.searchschemer.index.elasticsearch.ElasticSearchFieldAttributes

      String propertyName = reader.nextName();
      String value = reader.nextString();
      if (ElasticSearchMappingsNames.MULTI_FIELD.compareTo(value) == 0) {
        handleMultiField(name, typeName);
      } else {
        ElasticSearchFieldAttributes field = new ElasticSearchFieldAttributes();
        setName(field, typeName, name);
        setProperty(propertyName, value, field);
        handleFieldAttributes(field);
        fields.add(field);
      }
View Full Code Here

Examples of com.sematext.searchschemer.index.elasticsearch.ElasticSearchFieldAttributes

   */
  protected void handleMultiField(String name, String typeName) throws IOException {
    reader.nextName();
    reader.beginObject();
    while (JsonToken.END_OBJECT != reader.peek()) {
      ElasticSearchFieldAttributes field = new ElasticSearchFieldAttributes();
      String innerName = reader.nextName();
      if (innerName.compareTo(name) == 0) {
        setName(field, typeName, name);
      } else {
        setName(field, typeName, name + "." + innerName);
View Full Code Here

Examples of com.sematext.searchschemer.index.elasticsearch.ElasticSearchFieldAttributes

      return;
    }
    int length = typeName.length();
    for (FieldAttributes field : fields) {
      if (field.name().startsWith(typeName + ".")) {
        ElasticSearchFieldAttributes currentField = (ElasticSearchFieldAttributes) field;
        currentField.setName(field.name().substring(length + 1));
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.