How to set field values when put mapping

Hi guys,

The documents I want to index contains multiple fields, such as doc_id,
doc_content and doc_time.
I just want to create index in doc_content field. What should I do when put
mapping for these three fields.
For the other two fields I don't want to index, should I set "index" as
"no" or "not_analyzed" ?
By the way, I want to get doc_id and doc_time after I conduct a query on
doc_content, so I keep the two fields in the mapping.

XContentBuilder mapping = jsonBuilder()
.startObject()
.startObject("myType")
.startObject("properties")
.startObject("doc_id").field("type",
"string").field("index","not_analyzed").endObject()
.startObject("doc_content").field("type",
"string").field("index", "not_analyzed").endObject()

.startObject("doc_time").field("type","string").field("index","not_analyzed").endObject()
.endObject()
.endObject()
.endObject();
PutMappingRequest mappingRequest =
Requests.putMappingRequest("Myindex").type("myType").source(mapping);

I used above mapping settings, the index created for 8M data is ~37M. Is it
a normal phenomenon?
Any help would be appreciated.

--
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.

Hey

On Fri, Mar 8, 2013 at 2:47 PM, Jingang Wang bitwjg@gmail.com wrote:

The documents I want to index contains multiple fields, such as doc_id,
doc_content and doc_time.
I just want to create index in doc_content field. What should I do when
put mapping for these three fields.
For the other two fields I don't want to index, should I set "index" as
"no" or "not_analyzed" ?

Setting it to "no" makes sense if you do not want to search it (however it
is still available in the source field, if not explicitely disabled).

you might want to check
Elasticsearch Platform — Find real-time answers at scale | Elastic in
order to understand a part of your big index size.

--Alexander

--
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.