How to work with a json array

Hi all,

Environment
Windows 7 64bit
Elasticsearch, kibana, Logstash (5.0.0)

I have been trying to work with an example of a json array in the Elastic documentation but being new I'm not able to load it.
Attach json example

Attached index

Error when attempting to load via kibana
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "unknown setting [index.lists.0.description] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
}
],
"type": "illegal_argument_exception",
"reason": "unknown setting [index.lists.0.description] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
},
"status": 400
}

So understanding that I'm fairly green with this, can anyone please provide me steps to correctly set this example up in elastic.

Cheers

Hi,

Have you tried removing the index_name clause associated with the property "tags"?
I'm not sure if this property is defined in an index mapping context.

kind regards,

Guilherme

If you remove it, you'll need to reindex your data.

Hi Guilherme

Tried and failed... doesn't like the list

I'm just not sure what I need to write to accommodate an array.
I've used the example for Shakespeare just fine but the array has me beat.

Cheers for the assistance.

Have you followed the object reference? https://www.elastic.co/guide/en/elasticsearch/reference/5.0/object.html

According to the exception, it's something wrong with the description.type property. Just to test it, have you tried removing the types properties of the inner object. It doesn't seem to be the cause, but just to verify it.

Hi Guilherme

That link helped enormously
Here's what I did in kibana

PUT /tweets
{
"mappings": {
"tweet": {
"properties": {
"tweetid": { "type": "keyword" },
"message": { "type": "text" },
"tags": { "type": "text" },
"content": {
"properties": {
"name": { "type": "text" },
"msgbody": { "type": "text" }
}
}
}
}
}
}

DELETE /regmanagers
PUT /regmanagers
{
"mappings": {
"regmanagers": {
"properties": {
"region": { "type": "keyword" },
"country": { "type": "text" },
"manager": {
"properties": {
"age": { "type": "integer" },
"name": { "type": "text" }
}
}
}
}
}
}
}

This has worked as expected.
Man so happy I understand now.

Cheers

Hi again

Thought I'd provide an update on this
Created my index
PUT /test
{
"mappings": {
"tweet": {
"properties": {
"message": {"type": "text"},
"tags": {"type": "text"},
"content": {
"properties": {
"name": {"type": "text"},
"msgbody": {"type": "text"}
}
}
}
}
}
}
Then added content
JSON content
{"index":{"_index":"tweets", "_type":"content", "_id": "2"}}
{"message":"I've now added a second tweet...", "tags":"elasticsearch wow yahoo", "contents.name":"prog_list", "contents.msgbody":"programming list"}

d:\Apps\curl>curl -XPUT localhost:9200/_bulk --data-binary @tweets.json

Now I will be happy to close this request as I'm slowly getting the hang of what to do.

Cheers

Cool! Happy to know you did it! So, the solution was just replacing "string" to "text"?

Hi Guilherme

Actually it was a bit more than that. I used mappings in before the attribute and yes text seems to have resolved the other issues.
The link you provided was crucial to this resolution so thanks, greatly appreciate the tip.

Cheers

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.