Thanks. What would the mapping be, if I want to make all strings non-analysed.


Regards,

---------------------------------------------------------------------------------------------

Abhiman | Analyst

M: +91 8004274160 | www.tcg-digital.com

________________________________
From: Xavier Lange <[email protected]>
Sent: 21 April 2016 12:17:07
To: Abhiman
Cc: [email protected]
Subject: Re: [heka] Uploading To Elasticsearch a non-analysed field

Heka is not responsible for mappings in Elasticsearch. Heka doesn't create the 
mappings, that's a property of the dynamic schema in Elasticsearch. I highly 
recommend using an Elasticsearch index template to solve your problem. Here's a 
simple example:

curl -XPOST "$ES_URL/_template/event" -d '
{
  "order": 0,
  "template": "event-*",
  "settings": {
    "index.number_of_shards": "5"
  },
  "mappings": {
    "_default_": {
      "properties": {
        "nameOfMyUnanalyzedProperty": {
          "type": "string",
          "index": "not_analyzed"
        }
      }
    }
  },
  "aliases": {}
}
'

You can find more information here: 
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html
 . Note, you will need to drop your existing indexes because their schema is 
already determine to be analyzed.

Here's a more complicated example... something I wish I was given a while ago! 
This example disables analysis on all strings fields but turns on geo_point for 
one named property.

curl -XPOST "$ES_URL/_template/event" -d '
{
  "order": 0,
  "template": "event-*",
  "settings": {
    "index.number_of_shards": "1"
  },
  "mappings": {
    "_default_": {
      "dynamic_templates": [
        {
          "strings": {
            "match_mapping_type": "string",
            "mapping": {
              "index": "not_analyzed",
              "type": "string"
            }
          }
        }
      ],
      "properties": {
        "abcGeoCoords": {
          "type": "geo_point",
          "geohash_prefix": true,
          "geohash_precision": "1m"
        }
      }
    }
  },
  "aliases": {}
}
'

Hope this helps.

Xavier


On Apr 20, 2016, at 11:36 PM, Abhiman Talwar 
<[email protected]<mailto:[email protected]>> wrote:

I want to upload data to ES-server using HEKA. Everything was going fine till I
realized Heka uploads every field as 'analysed' and I want one field to be non-
analysed. How can I do that ?

Thanks

_______________________________________________
Heka mailing list
[email protected]<mailto:[email protected]>
https://mail.mozilla.org/listinfo/heka

_______________________________________________
Heka mailing list
[email protected]
https://mail.mozilla.org/listinfo/heka

Reply via email to