Avoid field indexing Java API


(Josef Fritzer) #1

Hi guys, I would like to use elastic for data storage, therefore I use the Index Request new IndexRequest(„myIndex“, „mytype“, „randomId“).source(„myJson“, Xcontent.Json). But i have to avoid that the fields of the added doc will be indexed. How do I set the „_doc“ {enabled:false} Parameter in Java? Thanks


(David Pilato) #2

You do that when creating the index not when indexing documents.

See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html#mappings


(Josef Fritzer) #3

Yep you're right, I just found the following in the documentation: https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-create-index.html

I guess this should work, when creating the index with the CreateIndexRequest

request.mapping("myType",
"{\n" +
" "myType": {\n" +
" "enabled": "false\“\n“
„}“
"}",
XContentType.JSON);


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.