From bcaeb226d5db61a2b54cb89a59bc44432eff6918 Mon Sep 17 00:00:00 2001 From: kimchy Date: Wed, 23 Feb 2011 19:55:48 +0200 Subject: [PATCH] Twitter river: "user.screen_name" should not be analyzed, closes #715. --- .../org/elasticsearch/river/twitter/TwitterRiver.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/river/twitter/src/main/java/org/elasticsearch/river/twitter/TwitterRiver.java b/plugins/river/twitter/src/main/java/org/elasticsearch/river/twitter/TwitterRiver.java index 41eadc89940..11befd87c03 100644 --- a/plugins/river/twitter/src/main/java/org/elasticsearch/river/twitter/TwitterRiver.java +++ b/plugins/river/twitter/src/main/java/org/elasticsearch/river/twitter/TwitterRiver.java @@ -194,9 +194,12 @@ public class TwitterRiver extends AbstractRiverComponent implements River { } logger.info("starting twitter stream"); try { - String mapping = XContentFactory.jsonBuilder().startObject().startObject(typeName) - .startObject("properties").startObject("location").field("type", "geo_point").endObject().endObject() - .endObject().endObject().string(); + String mapping = XContentFactory.jsonBuilder().startObject().startObject(typeName).startObject("properties") + .startObject("location").field("type", "geo_point").endObject() + .startObject("user").startObject("properties").startObject("screen_name").field("type", "string").field("index", "not_analyzed").endObject().endObject().endObject() + .startObject("mention").startObject("properties").startObject("screen_name").field("type", "string").field("index", "not_analyzed").endObject().endObject().endObject() + .startObject("in_reply").startObject("properties").startObject("user_screen_name").field("type", "string").field("index", "not_analyzed").endObject().endObject().endObject() + .endObject().endObject().endObject().string(); client.admin().indices().prepareCreate(indexName).addMapping(typeName, mapping).execute().actionGet(); } catch (Exception e) { if (ExceptionsHelper.unwrapCause(e) instanceof IndexAlreadyExistsException) {