I have a River on my local instance of ES 1.3.4 and JDBC For MySql 1.3.4.4
This river is working fine and importing data in ES. Problem I am facing that one of my field is a text field and has spaces in it. For example 'Real Time Calculator'. ES is indexing it as 'real', 'time' and 'calculator' instead of 'Real Time Calculator'.
So I am creating mapping using below mentioned JSON:
{
    "sale_test": {
        "properties": {
            "Client": {
                "index": "not_analyzed",
                "type": "string"
            },
            "OfferRGU": {
                "type": "long"
            },
            "SaleDate": {
                "format": "dateOptionalTime",
                "type": "date"
            },
            "State": {
                "type": "string"
            }
        }
    }
}
and Command:
curl -XPUT http://localhost:9200/my_index/_mapping/my_type
But I am getting below mentioned error:
> {"error":"MapperParsingException[Root type mapping not empty after
> parsing! Remaining fields:   [sale_test :
> {properties={Client={type=string, index=not_analyzed},
> OfferRGU={type=long}, SaleDate={type=date, format=dateOptionalTime},
> State={type=string}}}]]","status":400}
When I try to view current mapping using below mentioned command:
curl -XGET http://localhost:9200/dgses/sale_test_river/_mapping
I get only this: {}
Thanks for your help.
Your type is not consistent, in the API call the type is my_type
curl -XPUT http://localhost:9200/my_index/_mapping/my_type
then it becomes sale_test in the JSON message.
Having a consistent type will fix your problem:
curl -XPUT http://localhost:9200/my_index/_mapping/sale_test -d '
    { 
     "sale_test": { 
       "properties": { 
         "Client": {"type": "string", "index": "not_analyzed" }, 
         "OfferRGU": { "type": "long" }, 
         "SaleDate": { "type": "date", "format": "dateOptionalTime" },
         "State": { "type": "string" }
         } 
       } 
    }'
Here you have both a new index and a new type:
curl -XGET http://localhost:9200/dgses/sale_test_river/_mapping
Correcting the index and type gives me:
curl -XGET http://localhost:9200/my_index/sale_test/_mapping?pretty
{
  "myindex" : {
    "mappings" : {
      "sale_test" : {
        "properties" : {
          "Client" : {
            "type" : "string",
            "index" : "not_analyzed"
          },
          "OfferRGU" : {
            "type" : "long"
          },
          "SaleDate" : {
            "type" : "date",
            "format" : "dateOptionalTime"
          },
          "State" : {
            "type" : "string"
          }
        }
      }
    }
  }
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With