Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

elasticsearch change field type mapping to nested

I'm trying to change an elasticsearch field to nested, I'm having problems with the command to do this. I'm not sure if it's because it's a couple of fields down that is giving me grief.

Here's what I'm trying to input:

curl -XPUT 'http://localhost:9200/_mapping/data' -d '
{
"data" : {
    "properties" : {
        "parsed" : {
            "properties" : {
                "PMSetup" : {
                    "properties" : {
                        "Result" : {
                          "type" : "nested"
                          "include_in_parent" : true
                        },
                    }
                }
            }
        }
    }
}   
}
'

Can anyone help with this?

Thanks!

like image 530
timj123 Avatar asked May 12 '17 16:05

timj123


People also ask

What is nested mapping in Elasticsearch?

The nested type is a specialised version of the object data type that allows arrays of objects to be indexed in a way that they can be queried independently of each other.

How do I turn off dynamic mapping in Elasticsearch?

You can disable dynamic mapping, both at the document and at the object level. Setting the dynamic parameter to false ignores new fields, and strict rejects the document if Elasticsearch encounters an unknown field. Use the update mapping API to update the dynamic setting on existing fields.

What is nested field?

When a packed class contains an instance field that is a packed type, the data for that field is packed directly into the containing class. The field is known as a nested field .


1 Answers

Mapping cannot be updated for existing fields. The only thing you can do is DELETE your index and then PUT it back and POST mapping all over again.

like image 102
RoiHatam Avatar answered Sep 20 '22 18:09

RoiHatam