How to convert to JSON Query using Java HighlevelRestClient

ocalhost:9200/my_index/_mapping/doc { "properties": { "my_field": { "type": "text", "fielddata": true } } }

How to convert this to java API using HighLevelRestClient
highlevelRestClient.search(..........................................................

This is a PUT mapping operation. Not a search call. What do you mean?

hi David,
I want to sort the text fields ,so before sorting I want make fieldData= true , I have done it ,
like this
XContentBuilder jsonBuilder = XContentFactory.jsonBuilder()) {
final XContentBuilder builder = jsonBuilder
.startObject()
.startObject("your_type")
.startObject("properties")
.startObject("your_field")
.field("type", "text")
.field("fielddata", true)/setting fielddata/
.endObject()
.endObject()
.endObject()
.endObject();

But how to do this besides I am indexing using Logstash

thanks
David Raju Sammeta

Not sure why you want to do that in Java.
But here is the Put mapping API in Java: https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-put-mapping.html

yes I am using this in java , is there a possibility to use this put mapping stuff while indexing using logstash ,I mean I am using Logstash for indexing my ElasticSearch Data ,and I want to set the fieldData =true while indexing .

correct me if my problem statement is mis interpreting .

What is the relationship with Logstash here? I don't understand the picture so I can't give exact answers I'm afraid.

I am indexing my data into elastic search using logstash ,now I want to sort string fields ,but I am getting exceptions because I did't set the field data=true ,now I want to set this fieldData=true while indexing using logstash .

Note:I have done this using java but want to do this using Logstash

You need to define an index template probably. See

Thank u David Pilato ,I hope this works

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