title: Elasticsearch: Is it possible to index fields not present in source?
body: <p>Is it possible to make Elasticsearch index fields that are not present in the source document? An example of what I want to do is to index a <a href="http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-geo-point-type.html" rel="nofollow">Geo Point</a>, but not store the value and to leave it out of the <code>_source</code> field. Then I could do searches and aggregations based on location, geohash etc., but not return the position in the result documents themselves, e.g., for privacy reasons.</p>
  
  <p>The possibility seems to not be too far fetched, since mappings can cause fields in the source to be indexed in several different ways, for instance the Geo Point type can index <code>pos.lon</code>, <code>pos.lat</code> and <code>pos.geohash</code> even though these are not in the original source document.</p>
  
  <p>I have looked at <a href="http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-source-filtering.html" rel="nofollow">source filtering</a>, but that seems to only apply to searches and not indexing. I did not find a way to use it in aliases.</p>
  
  <p>The only way I've found to accomplish something like this would be to not store <code>_source</code>, but do store all other fields, except the single one I want to hide. That seems overly clumsy though.</p>