Search in sources :

Example 1 with TermQuery

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

the class BehaviorsTest method testSingleKeyDictionary.

@Test
public void testSingleKeyDictionary() {
    TermQuery q = new TermQuery.Builder().queryName("query-name").field("field-name").value(FieldValue.of("some-value")).build();
    q = checkJsonRoundtrip(q, "{\"field-name\":{\"_name\":\"query-name\",\"value\":\"some-value\"}}");
    assertEquals("query-name", q.queryName());
    assertEquals("field-name", q.field());
    assertEquals("some-value", q.value().stringValue());
}
Also used : TermQuery(org.opensearch.client.opensearch._types.query_dsl.TermQuery) MapBuilder(org.opensearch.client.util.MapBuilder) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 TermQuery (org.opensearch.client.opensearch._types.query_dsl.TermQuery)1 MapBuilder (org.opensearch.client.util.MapBuilder)1