Specify fields using the Elasticsearch Transport client


Tula

Is there a way to specify the fields that ES returns via the transport client (specifically using the BoolQueryBuilder)?

Using the REST API, this seems easy, for example, can I specify the result field in the elasticsearch query?

But not sure how to use the transport client. When looking at the BoolQueryBuilder class I don't see any definition of the fields.

Jettro Coenradie

In Java, your code should look like this:

SearchResponse searchResponse = client.prepareSearch("yourindex")
        .setQuery(boolQuery().must(matchAllQuery(), ...))
        .addFields("field1","field2")
        .get();

Related


Specify fields using the Elasticsearch Transport client

Tula Is there a way to specify the fields that ES returns via the transport client (specifically using the BoolQueryBuilder)? Using the REST API, this seems easy, for example, can I specify the result field in the elasticsearch query? But not sure how to use t

How to connect to ElasticSearch using Java transport client?

Manolis Karamanis I am following ElasticSearch documentation on Java Client. I have ElasticSearch started and can interact with it using the Rest API. I want to use a Java client, so far I have a body like this: public class TestElastic { public static void m

Elasticsearch Transport client connection

Akshay Bijawe I am building a Search Web Application with a servlet connected to Elasticsearch. I have a question about Elasticsearch 's shipping module . I am using TransportClient in a class implementing ServletContextListener to open a connection to Elastic

elasticsearch transport client with url path

Shakul Hameed My elasticsearch wrapped in tomcat using transport software is up and running in a cluster of 20 computers on a specific path /essearch. I have load balancer before clustering with dns, so I use www.dns.com/essearch/ to access elastic search Now

elasticsearch transport client with url path

Shakul Hameed My elasticsearch wrapped in tomcat using transport software is up and running in a cluster of 20 computers on a specific path /essearch. I have load balancer before clustering with dns, so I use www.dns.com/essearch/ to access elastic search Now

Loading completion fields in Elasticsearch using Nest Client

Brandon G I want to populate the completion suggestion field into the index using Nest. After reading the ElasticSearch blog post on implementing completion fields, I see that you can have the following properties: input array single output weight Payload I'm

How to handle transport errors in elasticsearch python client?

Hans I'm uploading a pandas dataframe to Elastic (using elasticsearch==6.3.1), it works fine if the dataframe size is less than 100MB, I'm using the solution from How to export pandas data to Elasticsearch ? def rec_to_actions(df): for record in df.to_dict

How to handle transport errors in elasticsearch python client?

Hans I'm uploading a pandas dataframe to Elastic (using elasticsearch==6.3.1), it works fine if the dataframe size is less than 100MB, I'm using the solution from How to export pandas data to Elasticsearch ? def rec_to_actions(df): for record in df.to_dict

How to handle transport errors in elasticsearch python client?

Hans I'm uploading a pandas dataframe to Elastic (using elasticsearch==6.3.1), it works fine if the dataframe size is less than 100MB, I'm using the solution from How to export pandas data to Elasticsearch ? def rec_to_actions(df): for record in df.to_dict

How to handle transport errors in elasticsearch python client?

Hans I'm uploading a pandas dataframe to Elastic (using elasticsearch==6.3.1), it works fine if the dataframe size is less than 100MB, I'm using the solution from How to export pandas data to Elasticsearch ? def rec_to_actions(df): for record in df.to_dict

How to handle transport errors in elasticsearch python client?

Hans I'm uploading a pandas dataframe to Elastic (using elasticsearch==6.3.1), it works fine if the dataframe size is less than 100MB, I'm using the solution from How to export pandas data to Elasticsearch ? def rec_to_actions(df): for record in df.to_dict

How to handle transport errors in elasticsearch python client?

Hans I'm uploading a pandas dataframe to Elastic (using elasticsearch==6.3.1), it works fine if the dataframe size is less than 100MB, I'm using the solution from How to export pandas data to Elasticsearch ? def rec_to_actions(df): for record in df.to_dict

Secure connection using transport client

St. Kaidal Need to connect to secure elasticsearch with https authentication using transport client in java code. I have the user id and password to connect, but need an example of how we do it? I am using elastic search 5.6.0. I'm looking for xpack and shelf

Secure connection using transport client

St. Kaidal Need to connect to secure elasticsearch with https authentication using transport client in java code. I have the user id and password to connect, but need an example of how we do it? I am using elastic search 5.6.0. I'm looking for xpack and shelf

Can I specify result fields in elasticsearch query?

Shaheed In my dataset, documents contain more than 20 fields with nested objects. Most of them are long text fields. These fields are very important for full text search, but we only need the title, short description and ID in the output. Is it possible to spe

Why specify fields by type instead of index in Elasticsearch?

Eric Anastas If multiple types in an Elasticsearch index have fields with the same name, those fields must have the same mapping, which tries to create the "foobar" property (string and long). For example, if you try to put the following index mapping: { "ma