Hi,
The following one is my template
{
- "order_template" : {*
- "template" : "",
- "order": 0,*
- "settings" :{*
- },*
- "mappings" : {*
- "default" : {*
- "_source" : {*
- "includes": [""],
- "excludes": ["text"]*
- }*
- }*
- }*
- }*
}
I am fetching the results using
SearchRequestBuilder builder =
client.prepareSearch(searchContext.getIndexName()).setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
- .setFrom(searchContext.getOffset()).setSize(searchContext.getSize());*
builder.setQuery(QueryBuilders.constantScoreQuery(FilterBuilders.queryFilter(queryBuilder)));
but updating is being done by following api
StringBuilder scriptBuilder = new StringBuilder();
scriptBuilder.append("ctx._source.").append("assigned").append("=").append("value");
client.prepareUpdate(index, type, id).setScript(scriptBuilder.toString());
after updating with above api, the hidden field, i.e, *data *field is lost.
I am doing any thing wrong while using api's.
Regards
Akram.
On Thursday, November 21, 2013 11:28:58 PM UTC+5:30, Ivan Brusic wrote:
It would help if you provided your mapping and an example query. Are you
searching against a certain field, the data field, or the _all field?
Create a gist as described here: Elasticsearch Platform — Find real-time answers at scale | Elastichttp://www.google.com/url?q=http%3A%2F%2Fwww.elasticsearch.org%2Fhelp%2F&sa=D&sntz=1&usg=AFQjCNGgo5_ert12o9OPxq7NdLYIOQ5Nig It
would help to retrieve the current mapping via the API, because some times
the mapping that is in effect might not be identical to the one you
supplied.
One issue to point out, in case it was not understood, is that some
updates to the mapping will not affect documents that are currently
indexed. How are you adding fields to a document? Are you reindexing or
using the update API?
Cheers,
Ivan
On Thu, Nov 21, 2013 at 4:57 AM, Akram Hussain <akram.hu...@gmail.com<javascript:>
wrote:
Hi,
Thanks for the reply.
It worked, but failed when try to add some other new fields to the source
from java api.
I have template like this
"mappings" : {
"default" : {
"_source" : {
"includes": ["*"],
"excludes": ["data"]
}
}
}
where only data field should be hidden, but it should be searchable.
- With the template I have created the doc like {"data" : "dataone",
"config": "config data", "status": "fine"}.
- When I searched for "dataone" using java api, it returned the correct
data, with remaining fields displayed not displaying "data" field - it
is fine.
- To the ssme document added some other fields like "assigned", etc -
They were added to document.
- But when I searched once again for "dataone" using java api, now the
search is not returning the data.
how to make "data" field, should not be lost after updated - I guess it
lost but not sure, but not returning in the search result at second time).
Regards,
Akram.
On Thursday, November 21, 2013 1:58:39 PM UTC+5:30, Hannes Korte wrote:
Hi Akram,
besides the solution of storing each field individually, you could as
well include and exclude certain fields in the source:
"_source" : {
"includes" : ["timestamp", "title", "tinyfields."],
"excludes" : ["largefields."]
}
Elasticsearch Platform — Find real-time answers at scale | Elastic
reference/current/mapping-source-field.htmlhttp://www.google.com/url?q=http%3A%2F%2Fwww.elasticsearch.org%2Fguide%2Fen%2Felasticsearch%2Freference%2Fcurrent%2Fmapping-source-field.html&sa=D&sntz=1&usg=AFQjCNE15ilwN5QEN-j9w-sjFFzjpz0dUA
Best regards,
Hannes
On 20.11.2013 17:39, Akram Hussain wrote:
Hi,
I have some data, which should be hidden/not displayed as part of the
_source.
when I set _source : { enabled : false}, source is being returned as
null.
How to make some fields are not displayed, but display _source.
Regards,
Akram.
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.