You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@MappedSuperclass
public class AuthorAbs extends Model {
// REVERSE ASSOCIATION
@OneToMany(mappedBy = "author", cascade = CascadeType.ALL, fetch = FetchType.LAZY) // name of the variable in the other object that references this object
public List<Quote> quotes = new ArrayList<Quote>(); // has_many :quotes
// FIELDS
@Required
public String first_name;
@Required
public String last_name;
}
@entity @table(name = "authors")
@ElasticSearchable
public class Author extends AuthorAbs {
public int years;
}
@entity @table(name = "quotes")
@ElasticSearchable
public class Quote extends Model {
// Associations
@ManyToOne() // Optional, targetEntity for indicating where's the relationship
@JoinColumn(name = "author_id") // name of the FK field in this table
// --
@Required
public Author author; // belongs_to_one :author
// Fields
@Required
public String quotation;
}
When updating an Author that has at least one Quote, throws the exception
12:34:22,451 ERROR ~
java.io.IOException: Type not allowed [class models.Quote]
at org.elasticsearch.common.xcontent.XContentBuilder.value(XContentBuilder.java:698)
at play.modules.elasticsearch.mapping.impl.CollectionFieldMapper.addToDocument(CollectionFieldMapper.java:94)
at play.modules.elasticsearch.mapping.impl.PlayModelMapper.addModel(PlayModelMapper.java:130)
at play.modules.elasticsearch.mapping.impl.PlayModelMapper.addModel(PlayModelMapper.java:26)
at play.modules.elasticsearch.adapter.ElasticSearchAdapter.indexModel(ElasticSearchAdapter.java:147)
at play.modules.elasticsearch.ElasticSearchIndexAction.invoke(ElasticSearchIndexAction.java:53)
at play.modules.elasticsearch.ElasticSearchIndexer.doJob(ElasticSearchIndexer.java:54)
at play.jobs.Job.doJobWithResult(Job.java:50)
at play.jobs.Job.call(Job.java:146)
at play.jobs.Job$1.call(Job.java:66)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
* org_elastic/master: (28 commits)
0.4 release
Add MapperTransformer
Use AbstractFieldMapper#getFieldValue()
Some refactoring; Mapper prefix folded into AbstractFieldMapper
feliperazeek#32 Added a transformer which uses a mapper
Make sure the user has not requested unknown fields
Minor restructuring
Made AFM#addField() non-static so we can access meta directly
Log json for index operation
Fix for feliperazeek#36 (Class references not cleaned up on hot reload)
Fix for feliperazeek#38 (@onetomany causes "Type not allowed" exception)
Fix for feliperazeek#34 (cannot parse indexed date on record retrieval)
Upgrade to ES 0.18.5
Fix for feliperazeek#37 (do not index @transient fields)
Fixed elasticSearch tag path (fixes bug in _at least_ 1.2.4-RC3)
Fixed route indentation to make file more readable
Add support for Float conversion to ReflectionUtil
Releasing 0.3
setQuery(QueryBuilder) is available from es-0.17.0 (See ES issue 994)
Log type mapping
...
Conflicts:
conf/routes
I have the following escenario:
Author <- Quote (quote has a reference to author)
@MappedSuperclass
public class AuthorAbs extends Model {
}
@entity
@table(name = "authors")
@ElasticSearchable
public class Author extends AuthorAbs {
public int years;
}
@entity
@table(name = "quotes")
@ElasticSearchable
public class Quote extends Model {
}
When updating an Author that has at least one Quote, throws the exception
12:34:22,451 ERROR ~
java.io.IOException: Type not allowed [class models.Quote]
at org.elasticsearch.common.xcontent.XContentBuilder.value(XContentBuilder.java:698)
at play.modules.elasticsearch.mapping.impl.CollectionFieldMapper.addToDocument(CollectionFieldMapper.java:94)
at play.modules.elasticsearch.mapping.impl.PlayModelMapper.addModel(PlayModelMapper.java:130)
at play.modules.elasticsearch.mapping.impl.PlayModelMapper.addModel(PlayModelMapper.java:26)
at play.modules.elasticsearch.adapter.ElasticSearchAdapter.indexModel(ElasticSearchAdapter.java:147)
at play.modules.elasticsearch.ElasticSearchIndexAction.invoke(ElasticSearchIndexAction.java:53)
at play.modules.elasticsearch.ElasticSearchIndexer.doJob(ElasticSearchIndexer.java:54)
at play.jobs.Job.doJobWithResult(Job.java:50)
at play.jobs.Job.call(Job.java:146)
at play.jobs.Job$1.call(Job.java:66)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
There's a full app in https://github.com/omaroman/recordtracking/tree/master/samples-and-tests/demo
The text was updated successfully, but these errors were encountered: