Search in sources :

Example 1 with ShapeQuery

use of org.opensearch.client.opensearch._types.query_dsl.ShapeQuery in project opensearch-java by opensearch-project.

the class BehaviorsTest method testAdditionalPropertyOnClass.

@Test
public void testAdditionalPropertyOnClass() {
    ShapeQuery q = new ShapeQuery.Builder().queryName("query-name").field("field-name").shape(_0 -> _0.relation(GeoShapeRelation.Disjoint)).ignoreUnmapped(true).build();
    q = checkJsonRoundtrip(q, "{\"field-name\":{\"relation\":\"disjoint\"},\"_name\":\"query-name\",\"ignore_unmapped\":true}");
    assertEquals("query-name", q.queryName());
    assertTrue(q.ignoreUnmapped());
    assertEquals(GeoShapeRelation.Disjoint, q.shape().relation());
    System.out.println(toJson(q));
}
Also used : ShapeQuery(org.opensearch.client.opensearch._types.query_dsl.ShapeQuery) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 ShapeQuery (org.opensearch.client.opensearch._types.query_dsl.ShapeQuery)1