1

I am using the Elasticsearch JSON Mapping as

{
    "mappings": {
        "test": {
            "_routing": {
                "path": "harvestdate", 
                "required": true
            }, 
            "_source": {
                "enabled": false
            }, 
            "properties": {
                "infoid": {
                    "precision_step": "0", 
                    "store": "yes", 
                    "type": "long"
                }, 
                "productid": {
                    "index": "not_analyzed", 
                    "omit_norms": "true", 
                    "omit_term_freq_and_positions": "true", 
                    "store": "yes", 
                    "type": "string"
                }, 
                "saleid": {
                    "precision_step": "0", 
                    "store": "yes", 
                    "type": "long"
                }
            }
        }
    }
}
  1. I am using the Index as index1
  2. I have to add a new field in the JSON and it looks like
    { "mappings": { "test": { "_routing": { "path": "harvestdate", "required": true }, "_source": { "enabled": false }, "properties": { "deal": { "index": "not_analyzed", "omit_norms": "true", "omit_term_freq_and_positions": "true", "store": "no", "type": "string" }, "infoid": { "precision_step": "0", "store": "yes", "type": "long" }, "productid": { "index": "not_analyzed", "omit_norms": "true", "omit_term_freq_and_positions": "true", "store": "yes", "type": "string" }, "saleid": { "precision_step": "0", "store": "yes", "type": "long" } } } } }

I am trying to update this mapping using Elasticsearch with the Index(index1) by using the command

curl -XPUT 'http://localhost:9200/index1/test/_mapping' -d  '{
    "mappings": {
        "test": {
            "_routing": {
                "path": "harvestdate", 
                "required": true
            }, 
            "_source": {
                "enabled": false
            }, 
            "properties": {
                "deal": {
                    "index": "not_analyzed", 
                    "omit_norms": "true", 
                    "omit_term_freq_and_positions": "true", 
                    "store": "no", 
                    "type": "string"
                }, 
                "infoid": {
                    "precision_step": "0", 
                    "store": "yes", 
                    "type": "long"
                }, 
                "productid": {
                    "index": "not_analyzed", 
                    "omit_norms": "true", 
                    "omit_term_freq_and_positions": "true", 
                    "store": "yes", 
                    "type": "string"
                }, 
                "saleid": {
                    "precision_step": "0", 
                    "store": "yes", 
                    "type": "long"
                }
            }
        }
    }
}' 

While checking the mapping the mapping it is not Set with the Updated Mapping in the Index(index1). What is the error in this curl or mapping?

Thanks in Advance!

Cheers!

1
  • I don't understand why the second block does not want to indent properly… Commented Jun 28, 2012 at 13:12

1 Answer 1

3

I think you need to remove the

"mappings": {

thing. From what I read (don't remember where, but on the elastic search mailing list, the "mappings" comes from the GET, but should not be here when PUTing, and IIRC, they want to do something in next versions about it).

Sign up to request clarification or add additional context in comments.

5 Comments

I tried by removing the "mappings": { .... } I am getting the following error...
I tried by removing the "mappings": { .... } I am getting the following error... ></html>curl: (6) Could not resolve host: true,omit_term_freq_and_positions; No data record of requested type l><head><title>Apache Tomcat/5.5.26 - Error report.....h1>HTTP Status 403 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report...body></html>curl: (3) [globbing] unmatched close brace/bracket at pos 5 curl: (3) [globbing] unmatched close brace/bracket at pos 1 curl: (3) [globbing] unmatched close brace/bracket at pos 1 curl: (3) [globbing] unmatched close brace/bracket at pos 1
@George it seems it cannot connect to Elastic Search. Something is wrong somewhere else ;-)
Hi, I am getting the error message as C:\Users\Admin> .p4qt"productid" : { "type" : "string", "store" : "no", "index" : "not_analyzed","omit_norms" : "true", "omit_term_freq _and_positions" : "true"} '.p4qt"productid"' is not recognized as an internal or external command, operable program or batch file. C:\Users\Admin> } '}' is not recognized as an internal or external command, operable program or batch file.
While running the curl in the command prompt it is showing the above error as..... curl: (1) Protocol 'http not supported or disabled in libcurl C:\Users\Admin> "test" : { '"test"' is not recognized as an internal or external command, operable program or batch file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.