diff --git a/includes/index_entity.inc b/includes/index_entity.inc
index 31fb2df..5cd1531 100644
--- a/includes/index_entity.inc
+++ b/includes/index_entity.inc
@@ -812,7 +812,8 @@ class SearchApiIndex extends Entity {
               );
             }
             if (isset($entity_types[$type])) {
-              $flat[$key]['type'] = search_api_nest_type('integer', $info['type']);
+              $base_type = isset($entity_types[$type]['entity keys']['name']) ? 'string' : 'integer';
+              $flat[$key]['type'] = search_api_nest_type($base_type, $info['type']);
               $flat[$key]['entity_type'] = $type;
             }
           }
