Unable to create mapping and settings using Java API


(Amit Soni) #1

hello everyone - I have settings and mapping defined in a single JSON
document and I have been trying to find a way to create index using that
JSON document. I tried different code snippets but have not found one which
allows me to create settings as well as mapping using one JSON document.

Any help on this will be great!

-Amit.

--
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/CAAOGaQ%2BEUsstyy7qdNq%2BRmHzA-Rp9mYNYnOoQ8HESiGAvXwXVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Michael McCandless) #2

Hmm, I'm able to create an index and its mappings/settings with a single
JSON request to http://localhost:9200/.

What settings are you trying to set?

Mike

http://blog.mikemccandless.com

On Thu, May 1, 2014 at 5:10 PM, Amit Soni amitsoni29@gmail.com wrote:

hello everyone - I have settings and mapping defined in a single JSON
document and I have been trying to find a way to create index using that
JSON document. I tried different code snippets but have not found one which
allows me to create settings as well as mapping using one JSON document.

Any help on this will be great!

-Amit.

--
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/CAAOGaQ%2BEUsstyy7qdNq%2BRmHzA-Rp9mYNYnOoQ8HESiGAvXwXVg%40mail.gmail.comhttps://groups.google.com/d/msgid/elasticsearch/CAAOGaQ%2BEUsstyy7qdNq%2BRmHzA-Rp9mYNYnOoQ8HESiGAvXwXVg%40mail.gmail.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/CAD7smRc-y_futLvWVuycgpxwSshJHawNWu8zrDkmZrfZ5sAnZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Amit Soni) #3

Actually I am using Java API which uses a node client (do not have http
port open). Finally I got it working but it look a bit amount of research.
Following is the code snippet:

    CreateIndexRequest indexCreateRequest = new

CreateIndexRequest(indexName);
indexCreateRequest.source(mappingSource); //entire JSON scrpit
//Execute index creation command
CreateIndexResponse indexCreateResponse =
client.admin().indices().create(indexCreateRequest).actionGet();

-Amit.

On Fri, May 2, 2014 at 3:46 AM, Michael McCandless <
michael.mccandless@elasticsearch.com> wrote:

Hmm, I'm able to create an index and its mappings/settings with a single
JSON request to http://localhost:9200/.

What settings are you trying to set?

Mike

http://blog.mikemccandless.com

On Thu, May 1, 2014 at 5:10 PM, Amit Soni amitsoni29@gmail.com wrote:

hello everyone - I have settings and mapping defined in a single JSON
document and I have been trying to find a way to create index using that
JSON document. I tried different code snippets but have not found one which
allows me to create settings as well as mapping using one JSON document.

Any help on this will be great!

-Amit.

--
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/CAAOGaQ%2BEUsstyy7qdNq%2BRmHzA-Rp9mYNYnOoQ8HESiGAvXwXVg%40mail.gmail.comhttps://groups.google.com/d/msgid/elasticsearch/CAAOGaQ%2BEUsstyy7qdNq%2BRmHzA-Rp9mYNYnOoQ8HESiGAvXwXVg%40mail.gmail.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/CAD7smRc-y_futLvWVuycgpxwSshJHawNWu8zrDkmZrfZ5sAnZw%40mail.gmail.comhttps://groups.google.com/d/msgid/elasticsearch/CAD7smRc-y_futLvWVuycgpxwSshJHawNWu8zrDkmZrfZ5sAnZw%40mail.gmail.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/CAAOGaQ%2BA9evo_zsdF9BwcxdwXfEwfR1-6YYLRwEAkWurGVorwQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4