|
21 | 21 |
|
22 | 22 | import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
23 | 23 | import static org.elasticsearch.index.query.FilterBuilders.geoIntersectionFilter;
|
24 |
| -import static org.elasticsearch.index.query.QueryBuilders.filteredQuery; |
25 |
| -import static org.elasticsearch.index.query.QueryBuilders.geoShapeQuery; |
26 |
| -import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; |
| 24 | +import static org.elasticsearch.index.query.QueryBuilders.*; |
27 | 25 | import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
28 | 26 | import static org.hamcrest.MatcherAssert.assertThat;
|
29 |
| -import static org.hamcrest.Matchers.equalTo; |
30 |
| -import static org.hamcrest.Matchers.instanceOf; |
| 27 | +import static org.hamcrest.Matchers.*; |
31 | 28 |
|
32 | 29 | import java.io.IOException;
|
33 | 30 | import java.util.List;
|
34 | 31 | import java.util.Map;
|
35 | 32 |
|
| 33 | +import org.elasticsearch.action.get.GetResponse; |
36 | 34 | import org.elasticsearch.action.search.SearchResponse;
|
37 | 35 | import org.elasticsearch.common.geo.builders.ShapeBuilder;
|
38 | 36 | import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
43 | 41 |
|
44 | 42 | public class GeoShapeIntegrationTests extends AbstractSharedClusterTest {
|
45 | 43 |
|
| 44 | + @Test |
| 45 | + public void testNullShape() throws Exception { |
| 46 | + String mapping = XContentFactory.jsonBuilder().startObject().startObject("type1") |
| 47 | + .startObject("properties").startObject("location") |
| 48 | + .field("type", "geo_shape") |
| 49 | + .endObject().endObject() |
| 50 | + .endObject().endObject().string(); |
| 51 | + prepareCreate("test").addMapping("type1", mapping).execute().actionGet(); |
| 52 | + ensureGreen(); |
| 53 | + |
| 54 | + client().prepareIndex("test", "type1", "aNullshape").setSource("{\"location\": null}").execute().actionGet(); |
| 55 | + GetResponse result = client().prepareGet("test", "type1", "aNullshape").execute().actionGet(); |
| 56 | + assertThat(result.getField("location"), nullValue()); |
| 57 | + } |
| 58 | + |
46 | 59 | @Test
|
47 | 60 | public void testIndexPointsFilterRectangle() throws Exception {
|
48 | 61 | String mapping = XContentFactory.jsonBuilder().startObject().startObject("type1")
|
|
0 commit comments