How can I retrieve 'mapping parameters' like "index", "index_options" and "norms"?

Hi to all!

I'm working on Elastic 5.4

I want to retrieve all mapping parameters (values for "index", "index_options", "norms") currently defined for a mapped object, but i can't find the way...

Here is what I'm doing:

1) I have defined a template

    curl -X PUT \
  'http://localhost:9200/_template/transactions_index_template' \
  -d '{
    "template": "transactions_index*",
    "mappings": {
        "transaction": {
            "_all": {
                "enabled": false
            },
            "properties": {
                "fieldA": {
                    "index_options": "docs",
                    "index": "not_analyzed",
                    "norms": false,
                    "type": "keyword"
                },
                "fieldB": {
                    "index_options": "docs",
                    "index": "no",
                    "norms": false,
                    "type": "keyword"
                },
                "fieldC": {
                    "index_options": "docs",
                    "index": "no",
                    "type": "long"
                }
            }
        }
    }
}'

2) Than, no matter what, i have completely defined an index

    curl -X PUT \
      'http://localhost:9200/transactions_index_2018_06/' \
      -H 'Content-Type: application/json' \
      -d '{
    "mappings": {
        "transaction": {
            "_all": {
                "enabled": false
            },
            "properties": {
                "fieldA": {
                    "index_options": "docs",
                    "index": "not_analyzed",
                    "norms": false,
                    "type": "keyword"
                },
                "fieldB": {
                    "index_options": "docs",
                    "index": "no",
                    "norms": false,
                    "type": "keyword"
                },
                "fieldC": {
                    "index_options": "docs",
                    "index": "no",
                    "type": "long"
                }
            }
        }
    }
    }'

When i get pretty info of the created index, the response lacks of the values for "index", "index_options", "norms"

curl -X GET
'http://localhost:9200/transactions_index_2018_06/?pretty='

RETURNS:

    {
    "mappings": {
        "transaction": {
            "_all": {
                "enabled": false
            },
            "properties": {
                "fieldA": {
                    "type": "keyword"
                },
                "fieldB": {
                    "type": "keyword"
                },
                "fieldC": {
                    "index_options": "docs",
                    "type": "long"
                }
            }
        }
    }
}

WHY? WHAT I HAVE TO DO?

up please

No ideas?... maybe someone can tell me that this has no sense... it would be a starting point :slight_smile:

@jimczi Do you have an idea?

1 Like

If you want to retrieve all mapping options you need to use the field mapping API and set include_defaults=true:
GET transactions_index_2018_06/_mapping/field/*?include_defaults=true
See https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html#_other_options

Thank you so much... it works!

Previously i tried with defaults this way

http://localhost:9200/transactions_index_2018_06/_mapping/?include_defaults=true&pretty

having no success...

Unfortunately didn't find the "/field/*" path parameter in my searches, but now, following your suggestion (as follows)

http://localhost:9200/transactions_index_2018_06/_mapping/field/*?include_defaults=true&pretty

i can retrieve all the information i need

Thank you again!

1 Like

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