How to create an index with the JavaScript API?


(el) #1

I would like to store a field in my index but do not get it work with
JavaScript, well CoffeeScript:

INDEX = "myindex"
exports.createIndexAd = () ->
client.indices.create
index:
INDEX
type:
'thing'
mappings:
INDEX:
properties:
url:
type: 'string'
store: 'yes'
analyzer: 'keyword'

I get no error when I create the index, but the field 'url' is not stored
when I index a document.

I tried this based on the documentation
(http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-indices-create)
but I do not understand it. Can anyone point me to an example how to create
an index with JavaScript?

--
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/103bbdc1-c4a1-4c27-88cf-c253d7b53e89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2