|
@@ -27,6 +27,7 @@ import org.elasticsearch.plugins.Plugin;
|
|
|
import org.elasticsearch.test.MockKeywordPlugin;
|
|
|
import org.elasticsearch.xcontent.ToXContent;
|
|
|
import org.elasticsearch.xcontent.XContentBuilder;
|
|
|
+import org.elasticsearch.xcontent.XContentType;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
@@ -44,6 +45,7 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcke
|
|
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertRequestBuilderThrows;
|
|
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
|
|
import static org.hamcrest.Matchers.equalTo;
|
|
|
+import static org.hamcrest.Matchers.greaterThan;
|
|
|
import static org.hamcrest.Matchers.notNullValue;
|
|
|
import static org.hamcrest.Matchers.nullValue;
|
|
|
|
|
@@ -1038,6 +1040,19 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|
|
assertEquals("expected to find term statistics in exactly one shard!", 2, sumDocFreq);
|
|
|
}
|
|
|
|
|
|
+ public void testTermVectorsWithIgnoredField() throws IOException, InterruptedException {
|
|
|
+ // setup indices
|
|
|
+ assertAcked(prepareCreate("index").setMapping("field", "type=long,ignore_malformed=true"));
|
|
|
+ ensureGreen();
|
|
|
+
|
|
|
+ // add a doc with a bad long field
|
|
|
+ indexRandom(true, client().prepareIndex("index").setId("1").setSource("{\"field\":\"foo\"}", XContentType.JSON));
|
|
|
+
|
|
|
+ // do a tv request for all fields, _ignored should be returned
|
|
|
+ TermVectorsResponse resp = client().prepareTermVectors("index", "1").setSelectedFields("*").get();
|
|
|
+ assertThat(resp.getFields().terms("_ignored").size(), greaterThan(0L));
|
|
|
+ }
|
|
|
+
|
|
|
public void testWithKeywordAndNormalizer() throws IOException, ExecutionException, InterruptedException {
|
|
|
// setup indices
|
|
|
String[] indexNames = new String[] { "with_tv", "without_tv" };
|