Error

hey
am not able to do mapping for the following code
PUT washroom
{
"mapping" : {
"jsondata" : {
"properties" : {

  "sno" : {"type": "integer"},
  "feedback_toilet_id": {"type": "keyword"},
  "sensor_value": {"type": "integer"},
  "people_count": {"type": "integer"},
  "satisfied": {"type": "integer"},
  "med_satisfied": {"type": "integer"},
  "not_satified": {"type": "integer"},
  "rfid_value": {"type": "keyword"},
  "timestamp": {"type": "date"}      
  
 }
}

}
}

and the error showing is:
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "unknown setting [index.mapping.jsondata.properties.feedback_toilet_id.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
}

If you look at the docs for the put mapping API, you need to send the mapping to PUT washroom/_mapping.

1 Like

if possible ,could you please show me an example.So that i could understand it better.

no.
its okay
i got it
thank you so much

See am a beginner.Could you please tell me what should i do next to add a large json file so that i could visualize in kibana

What does the file look like?

You probably want to look at Logstash for this, and this blog post is a good starting point.

1 Like

my file is a json file i would show you a part of it.
{
"sno": 1,
"feedback_toilet_id": "TOI101",
"sensor_value": 300,
"people_count": 12,
"satisfied": 11,
"med_satisfied": 11,
"not_satisfied": 12,
"rfid_value": "0",
"timestamp": "1524487792708"
},
{
"sno": 2,
"feedback_toilet_id": "TOI101",
"sensor_value": 50,
"people_count": 20,
"satisfied": 15,
"med_satisfied": 12,
"not_satisfied": 2,
"rfid_value": "0",
"timestamp": "1524816675362"
},
like this the file goes on upto sno:11500

so should i really need a logstash or is there any other method to do that.I heard about bulk API .But i dont really know how to use it.Please help.
By the way, my operating system is linux .

This is not in bulk format, so I would recommend Logstash.

if the file is in bulk format,then what can we have to do?

Then you can probably upload it directly using the bulk API, e.g. using curl, unless it is too large.

okay.
Yh I will try it out.

You can also write a little script or program that uploads it using one of the language clients.

Please if possible show me an example

red open washroom WRO4YfUPSYajzTpEAmEcYw 5 1

Am having the health of my indices as red.What should I do now to make it green?

hey please help me
while running this code:
$ curl -XPOST http://localhost:9200/_bulk?pretty --data-binary @zip.json

I am getting this error.
{
"error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
** "status" : 406**

I think this blog post explains it well.

1 Like

I tried running this code ,yet not working
$ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk?pretty --data-binary "@zip.json

What if you try this, which follows the example provided in the documentation?

$ curl -XPOST "localhost:9200/_bulk"  -H 'Content-Type: application/json' --data-binary @zip.json
1 Like

Its not working.

I have tried doing this :
POST /washroom/_bulk
** {"index":{"_index":"washroom","_type":"doc"}}**
{"sno": 0,"feedback_toilet_id": "TOI100", "sensor_value": 3,"people_count": 6,"satisfied": 1,"med_satisfied": 1,"not_satisfied": 2,"rfid_value": "3","timestamp": "1529775125"} **
** {"index":{"_index":"washroom","_type":"doc"}}

{"sno": 1,"feedback_toilet_id": "TOI101", "sensor_value": 4,"people_count": 7,"satisfied": 2,"med_satisfied": 2,"not_satisfied": 3,"rfid_value": "4","timestamp": "1529775125"} **
** {"index":{"_index":"washroom","_type":"doc"}}

{"sno": 2,"feedback_toilet_id": "TOI102", "sensor_value": 5,"people_count": 8,"satisfied": 3,"med_satisfied": 3,"not_satisfied": 4,"rfid_value": "5","timestamp": "1529775125"} **
** {"index":{"_index":"washroom","_type":"doc"}}

{"sno": 3,"feedback_toilet_id": "TOI103", "sensor_value": 6,"people_count": 9,"satisfied": 4,"med_satisfied": 4,"not_satisfied": 5,"rfid_value": "6","timestamp": "1529775125"} **
** {"index":{"_index":"washroom","_type":"doc"}}

{"sno": 4,"feedback_toilet_id": "TOI104", "sensor_value": 7,"people_count": 10,"satisfied": 5,"med_satisfied": 5,"not_satisfied": 6,"rfid_value": "7","timestamp": "1529775125"} **
** {"index":{"_index":"washroom","_type":"doc"}}

{"sno": 5,"feedback_toilet_id": "TOI105", "sensor_value": 8,"people_count": 11,"satisfied": 6,"med_satisfied": 6,"not_satisfied": 7,"rfid_value": "8","timestamp": "1529775125"} **
** {"index":{"_index":"washroom","_type":"doc"}}

{"sno": 6,"feedback_toilet_id": "TOI106", "sensor_value": 9,"people_count": 12,"satisfied": 7,"med_satisfied": 7,"not_satisfied": 8,"rfid_value": "9","timestamp": "1529775125"} **
** {"index":{"_index":"washroom","_type":"doc"}}

{"sno": 7,"feedback_toilet_id": "TOI107", "sensor_value": 10,"people_count": 13,"satisfied": 8,"med_satisfied": 8,"not_satisfied": 9,"rfid_value": "10","timestamp": "1529775125"} **
** {"index":{"_index":"washroom","_type":"doc"}}

{"sno": 8,"feedback_toilet_id": "TOI108", "sensor_value": 11,"people_count": 14,"satisfied": 9,"med_satisfied": 9,"not_satisfied": 10,"rfid_value": "11","timestamp": "1529775125"} **
** {"index":{"_index":"washroom","_type":"doc"}}

{"sno": 9,"feedback_toilet_id": "TOI109", "sensor_value": 12,"people_count": 15,"satisfied": 10,"med_satisfied": 10,"not_satisfied": 11,"rfid_value": "12","timestamp": "1529775125"} **
** {"index":{"_index":"washroom","_type":"doc"}}

{"sno": 10,"feedback_toilet_id": "TOI1010", "sensor_value": 13,"people_count": 16,"satisfied": 11,"med_satisfied": 11,"not_satisfied": 12,"rfid_value": "13","timestamp": "1529775125"}

and it shows error :
{
** "statusCode": 504,**
** "error": "Gateway Time-out",**
** "message": "Client request timeout"**
}

what should i do?