I have a Java class:
public class Audit {
public Map<String,String> newValues = new HashMap<String,String>();
...
Which I turn to JSON:
{"newValues":{"data":"sjab",...},...}
I get this error
Failed to parse [newValues.data]
Caused by: org.elasticsearch.index.mapper.MapperParsingException: Failed to
parse [newValues.data]
at
org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:327)
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:585)
at
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:449)
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeObject(ObjectMapper.java:497)
at
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:439)
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:493)
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:437)
at
org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:311)
at
org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:202)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:532)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:430)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
... 1 more
Caused by: org.elasticsearch.index.mapper.MapperParsingException: failed to
parse date field [true], tried both date format [dateOptionalTime], and
timestamp number
at
org.elasticsearch.index.mapper.core.DateFieldMapper.parseStringValue(DateFieldMapper.java:425)
at
org.elasticsearch.index.mapper.core.DateFieldMapper.parseCreateField(DateFieldMapper.java:354)
at
org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:314)
... 13 more
Caused by: java.lang.IllegalArgumentException: Invalid format: "true"
at
org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis(DateTimeFormatter.java:747)
at
org.elasticsearch.index.mapper.core.DateFieldMapper.parseStringValue(DateFieldMapper.java:419)
I tried putting various elements in schema.xml, but still get the error:
What to do?
(Other top-level fields work fine, but not the Strings in my map. It was
working earlier, then stopped!)
You can set the mapping for this field to String before sending the first doc.
I suppose that you sent a first doc with something like "2000-12" and that ES auto mapping thought it was a date.
So if you specify mapping first, ES will apply it.
I have a Java class:
public class Audit {
public Map<String,String> newValues = new HashMap<String,String>();
...
Which I turn to JSON:
{"newValues":{"data":"sjab",...},...}
I get this error
Failed to parse [newValues.data]
Caused by: org.elasticsearch.index.mapper.MapperParsingException: Failed to parse [newValues.data]
at org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:327)
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:585)
at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:449)
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeObject(ObjectMapper.java:497)
at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:439)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:493)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:437)
at org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:311)
at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:202)
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:532)
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:430)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
... 1 more
Caused by: org.elasticsearch.index.mapper.MapperParsingException: failed to parse date field [true], tried both date format [dateOptionalTime], and timestamp number
at org.elasticsearch.index.mapper.core.DateFieldMapper.parseStringValue(DateFieldMapper.java:425)
at org.elasticsearch.index.mapper.core.DateFieldMapper.parseCreateField(DateFieldMapper.java:354)
at org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:314)
... 13 more
Caused by: java.lang.IllegalArgumentException: Invalid format: "true"
at org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis(DateTimeFormatter.java:747)
at org.elasticsearch.index.mapper.core.DateFieldMapper.parseStringValue(DateFieldMapper.java:419)
I tried putting various elements in schema.xml, but still get the error:
What to do?
(Other top-level fields work fine, but not the Strings in my map. It was working earlier, then stopped!)
How do I set the type programmatically from Java? At the moment, I
inherited code like
client.prepareIndex(INDEX, "event", "abc123")
.setSource(json)
.execute()
.actionGet();
How do I set the type programmatically from Java? At the moment, I inherited code like
client.prepareIndex(INDEX, "event", "abc123")
.setSource(json)
.execute()
.actionGet();
How do I set the type programmatically from Java? At the moment, I inherited code like
client.prepareIndex(INDEX, "event", "abc123")
.setSource(json)
.execute()
.actionGet();
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.