Adding new fields showing Error


(vijuitech) #1

Hi,
I have added new field url with the existing JSON

test
{
properties{
.
.
.

"url" : { "type" : "string", "store" : "no", "index" :
"not_analyzed","omit_norms" : "true", "omit_term_freq_and_positions" :
"true"}

}
}

For setting up the mapping to all the indices I used,

curl -XPUT http://localhost:9200/index1/test/_mapping

After running this curl I got

{"error":"ElasticSearchParseException[Failed to derive xcontent
from ]","status":400}

How can I set the new field(ie url) with the existing Index(ie
index1)?

Cheers!

Thanks!

George


(Shay Banon) #2

You did not provide the command with an actual body (the mapping)...

On Mon, Jun 25, 2012 at 1:48 PM, George Viju vijuitech@gmail.com wrote:

Hi,
I have added new field url with the existing JSON

test
{
properties{
.
.
.

"url" : { "type" : "string", "store" : "no", "index" :
"not_analyzed","omit_norms" : "true", "omit_term_freq_and_positions" :
"true"}

}
}

For setting up the mapping to all the indices I used,

curl -XPUT http://localhost:9200/index1/test/_mapping

After running this curl I got

{"error":"ElasticSearchParseException[Failed to derive xcontent
from ]","status":400}

How can I set the new field(ie url) with the existing Index(ie
index1)?

Cheers!

Thanks!

George


(vijuitech) #3

Thank you Shay, I am using the JSON Mapping as

{
"mappings" : {

    "test" : {
        "_source" : { "enabled" : false },
         "_routing" : {
                   "required" : true,
                   "path" : "harvestdate"
        		  },

        "properties" : {
        	"infoid" : { "type" : "long", "store" : "yes",

"precision_step" : "0" },
"productid" : { "type" : "string", "store" : "yes",
"index" : "not_analyzed", "omit_norms" : "true",
"omit_term_freq_and_positions" : "true" },
"saleid" : { "type" : "long", "store" : "yes",
"precision_step" : "0" }

                       }
                 }
             }
  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" : {
        "_source" : { "enabled" : false },
         "_routing" : {
                   "required" : true,
                   "path" : "harvestdate"
        		  },

        "properties" : {
        	"infoid" : { "type" : "long", "store" : "yes",

"precision_step" : "0" },
"productid" : { "type" : "string", "store" : "yes",
"index" : "not_analyzed", "omit_norms" : "true",
"omit_term_freq_and_positions" : "true" },
"saleid" : { "type" : "long", "store" : "yes",
"precision_step" : "0" },
"deal" :{ "type" : "string", "store" : "no",
"index" : "not_analyzed","omit_norms" : "true",
"omit_term_freq_and_positions" : "true"}

                       }
                 }
             }

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

curl -XPUT 'http://localhost:9200/index1/test/_mapping' -d '{
"mappings" : {

    "test" : {
        "_source" : { "enabled" : false },
         "_routing" : {
                   "required" : true,
                   "path" : "harvestdate"
        		  },

        "properties" : {
        	"infoid" : { "type" : "long", "store" : "yes",

"precision_step" : "0" },
"productid" : { "type" : "string", "store" : "yes",
"index" : "not_analyzed", "omit_norms" : "true",
"omit_term_freq_and_positions" : "true" },
"saleid" : { "type" : "long", "store" : "yes",
"precision_step" : "0" },
"deal" :{ "type" : "string", "store" : "no",
"index" : "not_analyzed","omit_norms" : "true",
"omit_term_freq_and_positions" : "true"}

                       }
                 }
             }'

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!

George

On Jun 25, 4:52 pm, Shay Banon kim...@gmail.com wrote:

You did not provide the command with an actual body (the mapping)...

On Mon, Jun 25, 2012 at 1:48 PM, George Viju vijuit...@gmail.com wrote:

Hi,
I have added new field url with the existing JSON

test
{
properties{
.
.
.

"url" : { "type" : "string", "store" : "no", "index" :
"not_analyzed","omit_norms" : "true", "omit_term_freq_and_positions" :
"true"}

}
}

For setting up the mapping to all the indices I used,

curl -XPUThttp://localhost:9200/index1/test/_mapping

After running this curl I got

{"error":"ElasticSearchParseException[Failed to derive xcontent
from ]","status":400}

How can I set the new field(ie url) with the existing Index(ie
index1)?

Cheers!

Thanks!

George


(system) #4