Hi,

How do you use API to create index?

I think “dynamic” property is wrong place.

I try to create index to use the following JSON and index;

curl -XPOST localhost:9200/myidx -d '
{
  "settings": {
    "index.refresh_interval": "5m"
  },
  "mappings": {
    "message": {
      "dynamic": "strict",
      "_ttl": {
        "enabled": true
      },
      "properties": {
        "my_nested_thing": {
          "type": "nested",
          "properties": {
            "some_id": {
              "type": "string",
              "index": "not_analyzed"
            },
            "count": {
              "type": "long"
            }
          }
        }
      }
    }
  }
}'

curl -XGET localhost:9200/myidx/_mapping?pretty

{
  "myidx" : {
    "mappings" : {
      "message" : {
        "dynamic" : "strict",
        "_ttl" : {
          "enabled" : true
        },
        "properties" : {
          "my_nested_thing" : {
            "type" : "nested",
            "properties" : {
              "count" : {
                "type" : "long"
              },
              "some_id" : {
                "type" : "string",
                "index" : "not_analyzed"
              }
            }
          }
        }
      }
    }
  }
}

Does it make sense?

------------
Jun Ohtani
[email protected]
blog : http://blog.johtani.info
twitter : http://twitter.com/johtani

2014/06/06 22:31、Enno Shioji <[email protected]> のメール:

> Hi, I created my index using this mapping JSON:
> 
> {
>     "myidx": {
>         "index.refresh_interval":"5m",
>         "mappings": {
>             "dynamic": "strict",
>             "message": {
>                 "_ttl": {
>                     "enabled": true
>                 },
>                 "properties": {
>                     "my_nested_thing": {
>                         "type": "nested",
>                         "properties": {
>                             "some_id": {
>                                 "type": "string", "index": "not_analyzed"
>                             },
>                             "count": {
>                                 "type": "long"
>                             },
>                         }
>                     }
>                 }
>             }
>         }
>     }
> }
> 
> If I do a GET to _mapping after indexing some documents, it will essentially 
> return:
> 
>         {
>             "message": {
>                 "properties": {
>                     "my_nested_thing": {
>                         "properties": {
>                             "some_id": {
>                                 "type": "string", "index": "not_analyzed"
>                             },
>                             "count": {
>                                 "type": "long"
>                             },
>                         }
>                     }
>                 }
>             }
>         }
> 
> I.e. "_ttl": enabled=true and the "type": "nested" is not present from the 
> mapping. I also noticed that it allows auto update to the mapping despite the 
> "dynamic": "strict" instruction.
> 
> Does this mean these instructions are somehow not being reflected? If so, 
> what am I doing wrong?
> 
> I'm using version 1.2.1
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "elasticsearch" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elasticsearch/b57199bf-c01f-4b86-9d8d-a4acfb06618c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to