change mappersAdded flag to mappingsModified to better reflect any possible change in mappings, not just additions
This commit is contained in:
parent
79cb0eafc4
commit
e1fe89389c
|
@ -168,7 +168,7 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
|
|||
indexRequest.version(version);
|
||||
|
||||
// update mapping on master if needed, we won't update changes to the same type, since once its changed, it won't have mappers added
|
||||
if (op.parsedDoc().mappersAdded()) {
|
||||
if (op.parsedDoc().mappingsModified()) {
|
||||
if (mappingsToUpdate == null) {
|
||||
mappingsToUpdate = Sets.newHashSet();
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi
|
|||
// ignore
|
||||
}
|
||||
}
|
||||
if (op.parsedDoc().mappersAdded()) {
|
||||
if (op.parsedDoc().mappingsModified()) {
|
||||
updateMappingOnMaster(request);
|
||||
}
|
||||
// update the version on the request, so it will be used for the replicas
|
||||
|
|
|
@ -454,7 +454,7 @@ public class DocumentMapper implements ToXContent {
|
|||
context.reset(parser, new Document(), source, listener);
|
||||
// on a newly created instance of document mapper, we always consider it as new mappers that have been added
|
||||
if (initMappersAdded) {
|
||||
context.addedMapper();
|
||||
context.setMappingsModified();
|
||||
initMappersAdded = false;
|
||||
}
|
||||
|
||||
|
@ -518,7 +518,7 @@ public class DocumentMapper implements ToXContent {
|
|||
Collections.reverse(context.docs());
|
||||
}
|
||||
ParsedDocument doc = new ParsedDocument(context.uid(), context.id(), context.type(), source.routing(), source.timestamp(), source.ttl(), context.docs(), context.analyzer(),
|
||||
context.source(), context.mappersAdded()).parent(source.parent());
|
||||
context.source(), context.mappingsModified()).parent(source.parent());
|
||||
// reset the context to free up memory
|
||||
context.reset(null, null, null, null);
|
||||
return doc;
|
||||
|
|
|
@ -72,7 +72,7 @@ public class ParseContext {
|
|||
|
||||
private Map<String, String> ignoredValues = new HashMap<String, String>();
|
||||
|
||||
private boolean mappersAdded = false;
|
||||
private boolean mappingsModified = false;
|
||||
|
||||
private boolean externalValueSet;
|
||||
|
||||
|
@ -103,7 +103,7 @@ public class ParseContext {
|
|||
this.sourceToParse = source;
|
||||
this.source = source == null ? null : sourceToParse.source();
|
||||
this.path.reset();
|
||||
this.mappersAdded = false;
|
||||
this.mappingsModified = false;
|
||||
this.listener = listener == null ? DocumentMapper.ParseListener.EMPTY : listener;
|
||||
this.allEntries = new AllEntries();
|
||||
this.ignoredValues.clear();
|
||||
|
@ -117,12 +117,12 @@ public class ParseContext {
|
|||
return this.docMapperParser;
|
||||
}
|
||||
|
||||
public boolean mappersAdded() {
|
||||
return this.mappersAdded;
|
||||
public boolean mappingsModified() {
|
||||
return this.mappingsModified;
|
||||
}
|
||||
|
||||
public void addedMapper() {
|
||||
this.mappersAdded = true;
|
||||
public void setMappingsModified() {
|
||||
this.mappingsModified = true;
|
||||
}
|
||||
|
||||
public String index() {
|
||||
|
|
|
@ -49,15 +49,15 @@ public class ParsedDocument {
|
|||
|
||||
private final BytesReference source;
|
||||
|
||||
private boolean mappersAdded;
|
||||
private boolean mappingsModified;
|
||||
|
||||
private String parent;
|
||||
|
||||
public ParsedDocument(String uid, String id, String type, String routing, long timestamp, long ttl, Document document, Analyzer analyzer, BytesReference source, boolean mappersAdded) {
|
||||
this(uid, id, type, routing, timestamp, ttl, Arrays.asList(document), analyzer, source, mappersAdded);
|
||||
public ParsedDocument(String uid, String id, String type, String routing, long timestamp, long ttl, Document document, Analyzer analyzer, BytesReference source, boolean mappingsModified) {
|
||||
this(uid, id, type, routing, timestamp, ttl, Arrays.asList(document), analyzer, source, mappingsModified);
|
||||
}
|
||||
|
||||
public ParsedDocument(String uid, String id, String type, String routing, long timestamp, long ttl, List<Document> documents, Analyzer analyzer, BytesReference source, boolean mappersAdded) {
|
||||
public ParsedDocument(String uid, String id, String type, String routing, long timestamp, long ttl, List<Document> documents, Analyzer analyzer, BytesReference source, boolean mappingsModified) {
|
||||
this.uid = uid;
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
|
@ -67,7 +67,7 @@ public class ParsedDocument {
|
|||
this.documents = documents;
|
||||
this.source = source;
|
||||
this.analyzer = analyzer;
|
||||
this.mappersAdded = mappersAdded;
|
||||
this.mappingsModified = mappingsModified;
|
||||
}
|
||||
|
||||
public String uid() {
|
||||
|
@ -120,10 +120,10 @@ public class ParsedDocument {
|
|||
}
|
||||
|
||||
/**
|
||||
* Has the parsed document caused for new mappings to be added.
|
||||
* Has the parsed document caused mappings to be modified?
|
||||
*/
|
||||
public boolean mappersAdded() {
|
||||
return mappersAdded;
|
||||
public boolean mappingsModified() {
|
||||
return mappingsModified;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
|
|
@ -521,7 +521,7 @@ public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll {
|
|||
putMapper(objectMapper);
|
||||
// now re add it
|
||||
context.path().add(currentFieldName);
|
||||
context.addedMapper();
|
||||
context.setMappingsModified();
|
||||
}
|
||||
}
|
||||
// traverse and parse outside of the mutex
|
||||
|
@ -757,7 +757,7 @@ public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll {
|
|||
}
|
||||
}
|
||||
putMapper(mapper);
|
||||
context.addedMapper();
|
||||
context.setMappingsModified();
|
||||
}
|
||||
}
|
||||
if (newMapper) {
|
||||
|
|
|
@ -362,7 +362,7 @@ public class PercolatorExecutor extends AbstractIndexComponent {
|
|||
indexCache.clear(searcher.getIndexReader());
|
||||
}
|
||||
|
||||
return new Response(matches, request.doc().mappersAdded());
|
||||
return new Response(matches, request.doc().mappingsModified());
|
||||
}
|
||||
|
||||
private IndexService percolatorIndexServiceSafe() {
|
||||
|
|
Loading…
Reference in New Issue