Hi,
I've create default-mapping.json file with this content:
{
"default" : {
"_source" : {"enabled" : false}
}
}
in the elasticsearch / config folder but it seems that _source field is
stored anyway.
Probably I'm missing something or I did something wrong but don't have any
idea why default mapping didn't work in my case.
Hi,
I've create default-mapping.json file with this content:
{
"default" : {
"_source" : {"enabled" : false}
}
}
in the elasticsearch / config folder but it seems that _source field is
stored anyway.
Probably I'm missing something or I did something wrong but don't have any
idea why default mapping didn't work in my case.
Thank You for quick response,
Sorry, I'm used to work with java, but now tried curl with command you sent
(first one) and this error that I got :
{"error":"MapperParsingException[Failed to parse]; nested:
JsonParseException[Unexpected character (''' (code 39)): expected a valid
value (number, String, array, object, 'true', 'false' or 'null')\n at
[Source: [B@1636731; line: 1, column: 2]]; ","status":400}
As for any special path configured - the answer is no, i put only
default-mapping.json and that's all.
When did you get this failure? when you indexed the document? There isn't
really a difference between the Java index API and the curl (http REST)
API. How do you know that your default-mapping.json does not work? The curl
sample I gave helps to show that it works.
Thank You for quick response,
Sorry, I'm used to work with java, but now tried curl with command you
sent (first one) and this error that I got :
{"error":"MapperParsingException[Failed to parse]; nested:
JsonParseException[Unexpected character (''' (code 39)): expected a valid
value (number, String, array, object, 'true', 'false' or 'null')\n at
[Source: [B@1636731; line: 1, column: 2]]; ","status":400}
As for any special path configured - the answer is no, i put only
default-mapping.json and that's all.
This failure is happened on this command curl -XPUT
localhost:9200/test/type/1 -d '{"test" : "value"}'
But, this is not the issue, I know that default-mapping.json doesn't work ,
when I created (JAVA code) the index and on search i got the _source field.
Until I created a new index (manually and with mapping where I made _source
disabled) and then search doesn't returned the _source.
It seems to work for me, so if you can provide a details step by step (from
a fresh installation) process of what you do, so I can follow it here, I
can try and help.
This failure is happened on this command curl -XPUT
localhost:9200/test/type/1 -d '{"test" : "value"}'
But, this is not the issue, I know that default-mapping.json doesn't work
, when I created (JAVA code) the index and on search i got the _source
field.
Until I created a new index (manually and with mapping where I made
_source disabled) and then search doesn't returned the _source.
Yes, sure.
Fresh 0.18.5 download and extract.
Make a file default-mapping.json with :
{
"default" : {
"_source" : {"enabled" : false}
}
}
put it under config folder - no any other changes.
executed elastic search (btw Win 7 - 64).
Created index automatically by indexing data (using Java) and tried to
search (Java as well) - got _source field.
Stopped ES
Deleted ES data.
Started ES.
Created Index manually (using admin().indices().create(new
CreateIndexRequest("testindex").mapping(type, mapping)).
The mapping is next :
XContentBuilder data = jsonBuilder()
.startObject()
.startObject("type")
.startObject("_source")
.field("enabled", false)
.endObject()
.endObject()
.endObject();
No, config is the right place for it. I just double checked with 0.18.5,
and it works well. Can you try the steps I mentioned with curl and double
check that what I do works for you (I want to take your Java code out of
the picture)?
Place default-mapping.json under config/
Run curl -XPUT localhost:9200/test/type/1 -d '{"test" : "value"}'
Run curl localhost:9200/test/_mapping?pretty=1
After that, you should see in the mapping that source is disabled. If it
works for you, can you gist the Java code you use?
Hi,
Error when running curl -XPUT localhost:9200/test/type/1 -d '{"test" :
"value"}'
Could be that something wrong with curl ??
I see this error from the curl output :
{"error":"MapperParsingException[Failed to parse]; nested:
JsonParseException[Unexpected character (''' (code 39)): expected a valid
value (number, String, array, object, 'true', 'false' or 'null')\n
at [Source: [B@bcfa38; line: 1, column: 2]]; ","status":400}curl: (7)
couldn't connect to host
curl: (3) [globbing] unmatched close brace/bracket at pos 6
The exception on ES server side is :
org.elasticsearch.index.mapper.MapperParsingException: Failed to parse
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:480)
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:414)
at
org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:302)
at
org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:181)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:487)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:400)
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)
Caused by: org.elasticsearch.common.jackson.JsonParseException: Unexpected
character (''' (code 39)): expected a valid value (number, String, array,
object, 'true', 'false' or 'null')
at [Source: [B@bcfa38; line: 1, column: 2]
at
org.elasticsearch.common.jackson.JsonParser._constructError(JsonParser.java:1432)
at
org.elasticsearch.common.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:385)
at
org.elasticsearch.common.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:306)
at
org.elasticsearch.common.jackson.impl.Utf8StreamParser._handleUnexpectedValue(Utf8StreamParser.java:2084)
at
org.elasticsearch.common.jackson.impl.Utf8StreamParser._nextTokenNotInObject(Utf8StreamParser.java:600)
at
org.elasticsearch.common.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:486)
at
org.elasticsearch.common.xcontent.json.JsonXContentParser.nextToken(JsonXContentParser.java:46)
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:434)
... 8 more
Hi,
Error when running curl -XPUT localhost:9200/test/type/1 -d '{"test" :
"value"}'
Could be that something wrong with curl ??
I see this error from the curl output :
{"error":"MapperParsingException[Failed to parse]; nested:
JsonParseException[Unexpected character (''' (code 39)): expected a valid
value (number, String, array, object, 'true', 'false' or 'null')\n
at [Source: [B@bcfa38; line: 1, column: 2]]; ","status":400}curl: (7)
couldn't connect to host
curl: (3) [globbing] unmatched close brace/bracket at pos 6
The exception on ES server side is :
org.elasticsearch.index.mapper.MapperParsingException: Failed to parse
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:480)
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:414)
at
org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:302)
at
org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:181)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:487)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:400)
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)
Caused by: org.elasticsearch.common.jackson.JsonParseException: Unexpected
character (''' (code 39)): expected a valid value (number, String, array,
object, 'true', 'false' or 'null')
at [Source: [B@bcfa38; line: 1, column: 2]
at
org.elasticsearch.common.jackson.JsonParser._constructError(JsonParser.java:1432)
at
org.elasticsearch.common.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:385)
at
org.elasticsearch.common.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:306)
at
org.elasticsearch.common.jackson.impl.Utf8StreamParser._handleUnexpectedValue(Utf8StreamParser.java:2084)
at
org.elasticsearch.common.jackson.impl.Utf8StreamParser._nextTokenNotInObject(Utf8StreamParser.java:600)
at
org.elasticsearch.common.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:486)
at
org.elasticsearch.common.xcontent.json.JsonXContentParser.nextToken(JsonXContentParser.java:46)
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:434)
... 8 more
WOW !!!!!!!!!!!!!
With file it works.
Shay, so with input file I executed curl -XPUT localhost:9200/test/type/1
-d '{"test" : "value"}'
response was
: {"ok":true,"_index":"test","_type":"type","_id":"1","_version":1}
And response on curl localhost:9200/test/_mapping?pretty=1 :
So , I don't see _source here and when I'm executing curl
localhost:9200/myindex/_mapping?pretty=1 I'm also not see
_source field, but when I'm making search in java code :
SearchRequestBuilder searchRequestBuilder = client.prepareSearch("myindex");
searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
searchRequestBuilder.setQuery(textQuery( "_all", "slava");
searchRequestBuilder.setFrom(0).setSize(60).setExplain(false);
SearchResponse response = searchRequestBuilder.execute().actionGet();
Mmmm, the only other reason that I can think it might happen is that the
node you start joins another cluster (using multicast discovery), that does
not have this configuration. Can you check if it happens (the log will
output if it joins another cluster). You can disable multicast by
setting: discovery.zen.ping.multicast.enabled: false in the config file.
WOW !!!!!!!!!!!!!
With file it works.
Shay, so with input file I executed curl -XPUT localhost:9200/test/type/1
-d '{"test" : "value"}'
response was
: {"ok":true,"_index":"test","_type":"type","_id":"1","_version":1}
And response on curl localhost:9200/test/_mapping?pretty=1 :
So , I don't see _source here and when I'm executing curl
localhost:9200/myindex/_mapping?pretty=1 I'm also not see
_source field, but when I'm making search in java code :
SearchRequestBuilder searchRequestBuilder =
client.prepareSearch("myindex");
searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
searchRequestBuilder.setQuery(textQuery( "_all", "slava");
searchRequestBuilder.setFrom(0).setSize(60).setExplain(false);
SearchResponse response = searchRequestBuilder.execute().actionGet();
Actually the computer is no part of any network - home computer. So I'm
doubt is it part of any cluster at all.
Btw, when I'm explicitly create an index with mapping (java) code then
_source field is not returned by search.
I am not really sure..., I don't see where the problem is. Can someone else
try and recreate this problem, or verify that its not happening? I will
repeat the recreation:
Use a fresh elasticsearch 0.18.5 installation.
Place a file called default-mapping.json under config with the following
content:
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.