Configuring TTL mapping in JAVA API


(naveen rao) #1

Hi,

Can someone please let me know , how do we add mappings(_mapping) to add
ttl in java api( Just as we add via json {enabled:true }).I tried
searching for it but cudn't find anything relevant.

Any help would be appreciated.

Regards,
Naveen.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/54a7f336-9f06-4288-bc5a-ba691efbd195%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly-2) #2

Something like this:

      client.admin().indices().preparePutMapping(index)
          .setType("doc")
          .setSource(jsonBuilder().startObject()
                  .startObject("_ttl")
                      .field("enabled", true)
                  .endObject()
                  .startObject("properties")
                  .endObject()
              .endObject()
          )
          .execute()
          .actionGet();

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1243cec8-f9a0-4008-84c8-713d62469d7a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3