mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-04-01 12:58:29 +00:00
parent
a7f8e636ba
commit
be0cef0c43
@ -242,6 +242,7 @@ Meta fields (those beginning with underscore) are fields used by elasticsearch
|
|||||||
to provide special features. They now have limited configuration options.
|
to provide special features. They now have limited configuration options.
|
||||||
|
|
||||||
* `_id` configuration can no longer be changed. If you need to sort, use `_uid` instead.
|
* `_id` configuration can no longer be changed. If you need to sort, use `_uid` instead.
|
||||||
|
* `_type` configuration can no longer be changed.
|
||||||
|
|
||||||
=== Codecs
|
=== Codecs
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import org.apache.lucene.search.Filter;
|
|||||||
import org.apache.lucene.search.PrefixFilter;
|
import org.apache.lucene.search.PrefixFilter;
|
||||||
import org.apache.lucene.search.Query;
|
import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.lucene.BytesRefs;
|
import org.elasticsearch.common.lucene.BytesRefs;
|
||||||
import org.elasticsearch.common.lucene.Lucene;
|
import org.elasticsearch.common.lucene.Lucene;
|
||||||
@ -94,6 +95,9 @@ public class TypeFieldMapper extends AbstractFieldMapper<String> implements Inte
|
|||||||
public static class TypeParser implements Mapper.TypeParser {
|
public static class TypeParser implements Mapper.TypeParser {
|
||||||
@Override
|
@Override
|
||||||
public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||||
|
if (parserContext.indexVersionCreated().onOrAfter(Version.V_2_0_0)) {
|
||||||
|
throw new MapperParsingException(NAME + " is not configurable");
|
||||||
|
}
|
||||||
TypeFieldMapper.Builder builder = type();
|
TypeFieldMapper.Builder builder = type();
|
||||||
parseField(builder, builder.name, node, parserContext);
|
parseField(builder, builder.name, node, parserContext);
|
||||||
return builder;
|
return builder;
|
||||||
@ -187,6 +191,9 @@ public class TypeFieldMapper extends AbstractFieldMapper<String> implements Inte
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
|
if (writePre2xSettings == false) {
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
boolean includeDefaults = params.paramAsBoolean("include_defaults", false);
|
boolean includeDefaults = params.paramAsBoolean("include_defaults", false);
|
||||||
|
|
||||||
// if all are defaults, no sense to write it at all
|
// if all are defaults, no sense to write it at all
|
||||||
|
@ -227,7 +227,8 @@ public class CountQueryTests extends ElasticsearchIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void typeFilterTests(String index) throws Exception {
|
private void typeFilterTests(String index) throws Exception {
|
||||||
assertAcked(prepareCreate("test")
|
Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build();
|
||||||
|
assertAcked(prepareCreate("test").setSettings(indexSettings)
|
||||||
.addMapping("type1", jsonBuilder().startObject().startObject("type1")
|
.addMapping("type1", jsonBuilder().startObject().startObject("type1")
|
||||||
.startObject("_type").field("index", index).endObject()
|
.startObject("_type").field("index", index).endObject()
|
||||||
.endObject().endObject())
|
.endObject().endObject())
|
||||||
|
@ -417,7 +417,6 @@ public class SimpleAllMapperTests extends ElasticsearchSingleNodeTest {
|
|||||||
rootTypes.put(SizeFieldMapper.NAME, "{\"enabled\" : true}");
|
rootTypes.put(SizeFieldMapper.NAME, "{\"enabled\" : true}");
|
||||||
rootTypes.put(IndexFieldMapper.NAME, "{\"enabled\" : true}");
|
rootTypes.put(IndexFieldMapper.NAME, "{\"enabled\" : true}");
|
||||||
rootTypes.put(SourceFieldMapper.NAME, "{\"enabled\" : true}");
|
rootTypes.put(SourceFieldMapper.NAME, "{\"enabled\" : true}");
|
||||||
rootTypes.put(TypeFieldMapper.NAME, "{\"store\" : true}");
|
|
||||||
rootTypes.put("include_in_all", "true");
|
rootTypes.put("include_in_all", "true");
|
||||||
rootTypes.put("dynamic_date_formats", "[\"yyyy-MM-dd\", \"dd-MM-yyyy\"]");
|
rootTypes.put("dynamic_date_formats", "[\"yyyy-MM-dd\", \"dd-MM-yyyy\"]");
|
||||||
rootTypes.put("numeric_detection", "true");
|
rootTypes.put("numeric_detection", "true");
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
enabled:true,
|
enabled:true,
|
||||||
_source:{
|
_source:{
|
||||||
},
|
},
|
||||||
_type:{
|
|
||||||
},
|
|
||||||
_boost:{
|
_boost:{
|
||||||
null_value:2.0
|
null_value:2.0
|
||||||
},
|
},
|
||||||
|
@ -597,7 +597,8 @@ public class SearchQueryTests extends ElasticsearchIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void typeFilterTests(String index) throws Exception {
|
private void typeFilterTests(String index) throws Exception {
|
||||||
assertAcked(prepareCreate("test")
|
Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build();
|
||||||
|
assertAcked(prepareCreate("test").setSettings(indexSettings)
|
||||||
.addMapping("type1", jsonBuilder().startObject().startObject("type1")
|
.addMapping("type1", jsonBuilder().startObject().startObject("type1")
|
||||||
.startObject("_type").field("index", index).endObject()
|
.startObject("_type").field("index", index).endObject()
|
||||||
.endObject().endObject())
|
.endObject().endObject())
|
||||||
|
@ -967,7 +967,6 @@ public class ContextSuggestSearchTests extends ElasticsearchIntegrationTest {
|
|||||||
XContentBuilder mapping = jsonBuilder();
|
XContentBuilder mapping = jsonBuilder();
|
||||||
mapping.startObject();
|
mapping.startObject();
|
||||||
mapping.startObject(type);
|
mapping.startObject(type);
|
||||||
mapping.startObject("_type").field("index", "not_analyzed").endObject(); // Forcefully configure the _type field, since it can be randomized and if used as context it needs to be enabled
|
|
||||||
mapping.startObject("properties");
|
mapping.startObject("properties");
|
||||||
mapping.startObject(FIELD);
|
mapping.startObject(FIELD);
|
||||||
mapping.field("type", "completion");
|
mapping.field("type", "completion");
|
||||||
|
@ -312,11 +312,6 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||||||
XContentBuilder mappings = null;
|
XContentBuilder mappings = null;
|
||||||
if (frequently() && randomDynamicTemplates()) {
|
if (frequently() && randomDynamicTemplates()) {
|
||||||
mappings = XContentFactory.jsonBuilder().startObject().startObject("_default_");
|
mappings = XContentFactory.jsonBuilder().startObject().startObject("_default_");
|
||||||
if (randomBoolean()) {
|
|
||||||
mappings.startObject(TypeFieldMapper.NAME)
|
|
||||||
.field("index", randomFrom("no", "not_analyzed"))
|
|
||||||
.endObject();
|
|
||||||
}
|
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
mappings.startObject(TimestampFieldMapper.NAME)
|
mappings.startObject(TimestampFieldMapper.NAME)
|
||||||
.field("enabled", randomBoolean())
|
.field("enabled", randomBoolean())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user