I have created mappings for my index to tell the service not to sore certain fields. However, when I do a GET on the id of the document, I still the the value for that field.
Indexing a document, I declare the "body" field as:
"body" : {
"index_name": "body",
"type": "string",
"index": "analyzed",
"store": "no"
}
I don't want to to keep the body for security reasons. This is an issue for me for numerous fields across numerous document types I index. What can i do to make these valuables searchable, but not stored and not readable, in Elastic Search?
Do you mean that it is returned as part of the _source response? Fields by
default are not stored, but the actual json document used to index is
stored, which can be disabled by controlling the _source mapping.
I have created mappings for my index to tell the service not to sore
certain
fields. However, when I do a GET on the id of the document, I still the
the
value for that field.
Indexing a document, I declare the "body" field as:
"body" : {
"index_name": "body",
"type": "string",
"index": "analyzed",
"store": "no"
}
I don't want to to keep the body for security reasons. This is an issue
for
me for numerous fields across numerous document types I index. What can i
do to make these valuables searchable, but not stored and not readable, in
Elastic Search?
How can I get at the fields I've mapped at "store" : "yes" when I've disabled the source?
You are right, it was the _source where I was seeing the stored json document, and I need to make sure I'm not holding on to that. So, I used the "_source" mapping as you advised:
It gets rid of the source json, but now I can't get anything from the document other than the ID. (I can get the id on the org.elasticsearch.search.SearchHit objects in the org.elasticsearch.search.SearchHits list in org.elasticsearch.action.search.SearchResponse.)
I want to still be able to get at some of the fields (those I mapped as "store" : "yes"). Disabling the source, I of course now get nulls from these methods on org.elasticsearch.search.SearchHit:
sourceAsMap() (what I had been calling before disabling source)
getSource()
And I get empty maps back from these methods on org.elasticsearch.search.SearchHit:
getFields()
getHighlightFields()
fields()
How can I get at the fields I've mapped at "store" : "yes" when I've
disabled
the source?
You are right, it was the _source where I was seeing the stored json
document, and I need to make sure I'm not holding on to that. So, I used
the "_source" mapping as you advised:
It gets rid of the source json, but now I can't get anything from the
document other than the ID. (I can get the id on the
org.elasticsearch.search.SearchHit objects in the
org.elasticsearch.search.SearchHits list in
org.elasticsearch.action.search.SearchResponse.)
I want to still be able to get at some of the fields (those I mapped as
"store" : "yes"). Disabling the source, I of course now get nulls from
these methods on org.elasticsearch.search.SearchHit:
sourceAsMap() (what I had been calling before disabling source)
getSource()
And I get empty maps back from these methods on
org.elasticsearch.search.SearchHit:
getFields()
getHighlightFields()
fields()
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.