@Test
public void checkConstantMapping() throws Exception {

    ElasticsearchQuery esQuery = new ElasticsearchQuery(null, null, null);
    Map<String, Object> source = new HashMap<>();
    String value = esQuery.getField(source, "test");
    assertTrue(value.isEmpty());
    value = esQuery.getField(source, "'value'");
    assertEquals("value", value);
    value = esQuery.getField(source, "test|'value'");
    assertEquals("value", value);
    source.put("test", "newvalue");
    value = esQuery.getField(source, "test|'value'");
    assertEquals("newvalue", value);
    Map<String, Object> test = new HashMap<>();
    test.put("propA", "valueA");
    test.put("propB", "valueB");
    source.put("test", test);
    value = esQuery.getField(source, "test|'value'");
    assertEquals("value", value);
    value = esQuery.getField(source, "|'value'");
    assertEquals("value", value);
    value = esQuery.getField(source, "test.propA|'value'");
    assertEquals("valueA", value);
    value = esQuery.getField(source, "test.propB|'value'");
    assertEquals("valueB", value);
}