Twitter river: "user.screen_name" should not be analyzed, closes #715.

This commit is contained in:
kimchy 2011-02-23 19:55:48 +02:00
parent be1b46061e
commit bcaeb226d5
1 changed files with 6 additions and 3 deletions

View File

@ -194,9 +194,12 @@ public class TwitterRiver extends AbstractRiverComponent implements River {
} }
logger.info("starting twitter stream"); logger.info("starting twitter stream");
try { try {
String mapping = XContentFactory.jsonBuilder().startObject().startObject(typeName) String mapping = XContentFactory.jsonBuilder().startObject().startObject(typeName).startObject("properties")
.startObject("properties").startObject("location").field("type", "geo_point").endObject().endObject() .startObject("location").field("type", "geo_point").endObject()
.endObject().endObject().string(); .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(); client.admin().indices().prepareCreate(indexName).addMapping(typeName, mapping).execute().actionGet();
} catch (Exception e) { } catch (Exception e) {
if (ExceptionsHelper.unwrapCause(e) instanceof IndexAlreadyExistsException) { if (ExceptionsHelper.unwrapCause(e) instanceof IndexAlreadyExistsException) {