Package org.elasticsearch.search

Examples of org.elasticsearch.search.SearchHit.field()


              Object v = null;
              SearchHitField shf = null;
              if ("_source".equals(idx_resultField)) {
                v = hit.getSource();
              } else {
                shf = hit.field(idx_resultField);
                if (shf != null) {
                  v = shf.getValue();
                }
              }
              if (shf != null || v != null) {
View Full Code Here


              Object v = null;
              SearchHitField shf = null;
              if ("_source".equals(idx_resultField)) {
                v = hit.getSource();
              } else {
                shf = hit.field(idx_resultField);
                if (shf != null) {
                  v = shf.getValue();
                }
              }
              if (shf != null || v != null) {
View Full Code Here

        for (int i=0; i < Math.min(response.getHits().getTotalHits(), nbOfResultsToCheck); i++) {
            SearchHit hit = response.getHits().getAt(i);
            int docId = Integer.parseInt(hit.getId());

            assertThat(hit.field("foo"), notNullValue());
            assertThat(hit.field("foo").getValue().toString(), is("bar"));
            assertThat(hit.field("_id"), nullValue());
            if ((docId % 2) == 0) {
                assertThat(hit.field("content"), nullValue());
            } else {
View Full Code Here

        for (int i=0; i < Math.min(response.getHits().getTotalHits(), nbOfResultsToCheck); i++) {
            SearchHit hit = response.getHits().getAt(i);
            int docId = Integer.parseInt(hit.getId());

            assertThat(hit.field("foo"), notNullValue());
            assertThat(hit.field("foo").getValue().toString(), is("bar"));
            assertThat(hit.field("_id"), nullValue());
            if ((docId % 2) == 0) {
                assertThat(hit.field("content"), nullValue());
            } else {
                assertThat(hit.field("content").getValue().toString(), is(hit.getId()));
View Full Code Here

            SearchHit hit = response.getHits().getAt(i);
            int docId = Integer.parseInt(hit.getId());

            assertThat(hit.field("foo"), notNullValue());
            assertThat(hit.field("foo").getValue().toString(), is("bar"));
            assertThat(hit.field("_id"), nullValue());
            if ((docId % 2) == 0) {
                assertThat(hit.field("content"), nullValue());
            } else {
                assertThat(hit.field("content").getValue().toString(), is(hit.getId()));
            }
View Full Code Here

            assertThat(hit.field("foo"), notNullValue());
            assertThat(hit.field("foo").getValue().toString(), is("bar"));
            assertThat(hit.field("_id"), nullValue());
            if ((docId % 2) == 0) {
                assertThat(hit.field("content"), nullValue());
            } else {
                assertThat(hit.field("content").getValue().toString(), is(hit.getId()));
            }
        }
    }
View Full Code Here

            assertThat(hit.field("foo").getValue().toString(), is("bar"));
            assertThat(hit.field("_id"), nullValue());
            if ((docId % 2) == 0) {
                assertThat(hit.field("content"), nullValue());
            } else {
                assertThat(hit.field("content").getValue().toString(), is(hit.getId()));
            }
        }
    }

    /**
 
View Full Code Here

          if (resp.getHits().getTotalHits() > 1) {
            logger.warn("More results found for lookup over value {}", sourceValue);
          }
          SearchHit hit = resp.getHits().hits()[0];
          for (Map<String, String> mappingRecord : resultMapping) {
            Object v = hit.field(mappingRecord.get(CFG_idx_result_field)).getValue();
            if (v == null && mappingRecord.get(CFG_value_default) != null) {
              v = ValueUtils.processStringValuePatternReplacement(mappingRecord.get(CFG_value_default), data,
                  sourceValue);
            }
            value.put(mappingRecord.get(CFG_target_field), v);
View Full Code Here

          if (resp.getHits().getTotalHits() > 1) {
            logger.warn("More results found for lookup over value {}", sourceValue);
          }
          SearchHit hit = resp.getHits().hits()[0];
          for (Map<String, String> mappingRecord : resultMapping) {
            Object v = hit.field(mappingRecord.get(CFG_idx_result_field)).getValue();
            if (v == null && mappingRecord.get(CFG_value_default) != null) {
              v = ValueUtils.processStringValuePatternReplacement(mappingRecord.get(CFG_value_default), data,
                  sourceValue);
            }
            value.put(mappingRecord.get(CFG_target_field), v);
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.