Hi Dom You need to consult the Elasticsearch documentation for mapping. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-core-types.html#string
What you're looking for is: .... properties => { somefield => { type => 'string', index => 'not_analyzed' } } .... Clint On 10 March 2014 18:45, Dominic Nicholas <dominic.s.nicho...@gmail.com>wrote: > Hi Clinton, > > I really appreciate the fast reply. We're now using Search::Elasticsearch. > I'm still having a problem getting mappings set and hope you can help. > What I'm trying to do is turn of the analyzer for certain fields. Here is > what I have : > > In Perl : > > %mappings = ( > 'index' => 'idx-2014.03.10', > 'type' => 'my_type', > 'body' => { > 'my_type' => { > "properties" => { > 'somefield' => > 'not_analyzed' > } > } > } > ); > > eval { $es_result = $elastic_search_object->indices->put_mapping( > \%mappings ) ; }; > etc etc > > The put_mapping call does not return an error. > > In JSON format, the mappings hash is : > > { > "index" : "idx-2014.03.10", > "type" : "my_type" > "body" : { > "my_type" : { > "properties" : { > "somefield" : "not_analyzed" > } > } > } > } > > When I try to get the mappings for the this type/index with : > > curl -XGET 'localhost:9200/idx-2014.03.10/my_type/_mapping' > > I get {} which I think means there are no mappings yet set for this index > and type. > > Is the body section above of the correct structure ? Is 'properties' > always required ? Any guidance would be much appreciated again. > > I've been using these as guides so far : > - > https://metacpan.org/pod/Search::Elasticsearch::Client::Direct::Indices#put_mapping > - > http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-put-mapping.html > - some training docs > > Thanks again > Dom > > > On Monday, March 10, 2014 10:35:21 AM UTC-4, Dominic Nicholas wrote: >> >> Hi, >> >> I'm using the Elasticsearch Perl module and need guidance on setting up >> mappings. >> I'm using the bulk() method to index data. Here is an example of the >> structure of the data : >> >> $response = $e->bulk( >> "index" : "idx-2014.03.10", >> "type" : "my_type", >> "body" : [ >> { >> "index" : { >> "_index" : "idx-2014.03.10", >> "_id" : "4410", >> "_type" : "my_type" >> } >> }, >> { >> "something" : "interesting", >> "somethingelse" : "also interesting" >> }, >> { >> "index" : { >> "_index" : "idx-2014.03.10", >> "_id" : "4411", >> "_type" : "my_type" >> } >> }, >> { >> "something" : "very interesting", >> "somethingelse" : "not interesting" >> } >> ] >> ); >> >> How do I set up mappings on various fields in the above example for >> 'something' and 'somethingelse' fields ? >> Also, how do I turn off the analyzer for an index (index: not_analyzed) >> too ? >> >> I know there are several ways of setting up mappings such as : >> >> - when creating an index >> - by using the dedicated update mapping api >> - using index templates >> >> Ideally I'd like to use the dedicated update mapping api but am unclear >> how to use that through the Perl library interface (eg use >> transport->perform_request() ?). >> >> Thanks for any guidance and help. >> >> Dom >> >> -- > 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+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/f23f9a91-3176-4bea-8258-c9d38d1dd34f%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/f23f9a91-3176-4bea-8258-c9d38d1dd34f%40googlegroups.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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAPt3XKTT2hw3msuptTr1ir5AR7KBB_11z1S4_xOJh38Qui4wCg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.