Is _timeStamp a kind of hidden field?

Hi,

Is _timeStamp a kind of hidden field ? Why is this field not displayed in
the result (see hereafter response result) ?

Code

    XContentBuilder mapping = XContentFactory.jsonBuilder()
            .startObject()
              .startObject("time-type")
                .startObject("_timestamp")
                  .field("enabled", true)
                  .field("store", "yes")
                .endObject()
              .endObject()
            .endObject();

    client.admin().indices().prepareCreate("timestamp-id")
            .addMapping("time-type", mapping)
            .execute().actionGet();

    client.prepareIndex("timestamp-id", "time-type", "1")
       .setSource("field1", "value1")
       .setTimestamp("2013-01-01T00:00:00")
       .setRefresh(true).execute().actionGet();

    requestBuilder = client.prepareSearch("timestamp-id")

.setQuery(QueryBuilders.rangeQuery("_timestamp").gte("2012-01-01").lte("2014-01-01"));

    response = requestBuilder.execute().actionGet();

Query :

{
"query" : {
"range" : {
"_timestamp" : {
"from" : "2012-01-01",
"to" : "2014-01-01",
"include_lower" : true,
"include_upper" : true
}
}
}
}

Response

Search result 1 : {
"took" : 17,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "timestamp-id",
"_type" : "time-type",
"_id" : "1",
"_score" : 1.0, "_source" : {"field1":"value1"}
} ]
}
}

Regards,

Charles

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

By default, you only get back the document's source (if enabled). If you
want a field, including the timestamp field, you must explicitly ask for it.

--
Ivan

On Wed, Aug 7, 2013 at 11:54 PM, Charles Moulliard ch007m@gmail.com wrote:

Hi,

Is _timeStamp a kind of hidden field ? Why is this field not displayed in
the result (see hereafter response result) ?

Code

    XContentBuilder mapping = XContentFactory.jsonBuilder()
            .startObject()
              .startObject("time-type")
                .startObject("_timestamp")
                  .field("enabled", true)
                  .field("store", "yes")
                .endObject()
              .endObject()
            .endObject();

    client.admin().indices().prepareCreate("timestamp-id")
            .addMapping("time-type", mapping)
            .execute().actionGet();

    client.prepareIndex("timestamp-id", "time-type", "1")
       .setSource("field1", "value1")
       .setTimestamp("2013-01-01T00:00:00")
       .setRefresh(true).execute().actionGet();

    requestBuilder = client.prepareSearch("timestamp-id")

.setQuery(QueryBuilders.rangeQuery("_timestamp").gte("2012-01-01").lte("2014-01-01"));

    response = requestBuilder.execute().actionGet();

Query :

{
"query" : {
"range" : {
"_timestamp" : {
"from" : "2012-01-01",
"to" : "2014-01-01",
"include_lower" : true,
"include_upper" : true
}
}
}
}

Response

Search result 1 : {
"took" : 17,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "timestamp-id",
"_type" : "time-type",
"_id" : "1",
"_score" : 1.0, "_source" : {"field1":"value1"}
} ]
}
}

Regards,

Charles

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hello!

Try specifying the fields property for your query http://www.elasticsearch.org/guide/reference/api/search/fields/

By default it will load the _source field.

--

Regards,

Rafał Kuć

Sematext :: http://sematext.com/ :: Solr - Lucene - ElasticSearch

Hi,

Is _timeStamp a kind of hidden field ? Why is this field not displayed in the result (see hereafter response result) ?

Code

    XContentBuilder mapping = XContentFactory.jsonBuilder()


            .startObject()


              .startObject("time-type")


                .startObject("_timestamp")


                  .field("enabled", true)


                  .field("store", "yes")


                .endObject()


              .endObject()


            .endObject();




    client.admin().indices().prepareCreate("timestamp-id")


            .addMapping("time-type", mapping)


            .execute().actionGet();




    client.prepareIndex("timestamp-id", "time-type", "1")


       .setSource("field1", "value1")


       .setTimestamp("2013-01-01T00:00:00")


       .setRefresh(true).execute().actionGet();




    requestBuilder = client.prepareSearch("timestamp-id")


            .setQuery(QueryBuilders.rangeQuery("_timestamp").gte("2012-01-01").lte("2014-01-01"));




    response = requestBuilder.execute().actionGet();

Query :

{

"query" : {

"range" : {


  "_timestamp" : {


    "from" : "2012-01-01",


    "to" : "2014-01-01",


    "include_lower" : true,


    "include_upper" : true


  }


}

}

}

Response

Search result 1 : {

"took" : 17,

"timed_out" : false,

"_shards" : {

"total" : 5,


"successful" : 5,


"failed" : 0

},

"hits" : {

"total" : 1,


"max_score" : 1.0,


"hits" : [ {


  "_index" : "timestamp-id",


  "_type" : "time-type",


  "_id" : "1",


  "_score" : 1.0, "_source" : {"field1":"value1"}


} ]

}

}

Regards,

Charles

--

You received this message because you are subscribed to the Google Groups "elasticsearch" group.

To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Like that

{
"fields" : ["_timestamp"],
"query" : {
...
}
}

?

On Thursday, August 8, 2013 8:54:00 AM UTC+2, Charles Moulliard wrote:

Hi,

Is _timeStamp a kind of hidden field ? Why is this field not displayed in
the result (see hereafter response result) ?

Code

    XContentBuilder mapping = XContentFactory.jsonBuilder()
            .startObject()
              .startObject("time-type")
                .startObject("_timestamp")
                  .field("enabled", true)
                  .field("store", "yes")
                .endObject()
              .endObject()
            .endObject();

    client.admin().indices().prepareCreate("timestamp-id")
            .addMapping("time-type", mapping)
            .execute().actionGet();

    client.prepareIndex("timestamp-id", "time-type", "1")
       .setSource("field1", "value1")
       .setTimestamp("2013-01-01T00:00:00")
       .setRefresh(true).execute().actionGet();

    requestBuilder = client.prepareSearch("timestamp-id")

.setQuery(QueryBuilders.rangeQuery("_timestamp").gte("2012-01-01").lte("2014-01-01"));

    response = requestBuilder.execute().actionGet();

Query :

{
"query" : {
"range" : {
"_timestamp" : {
"from" : "2012-01-01",
"to" : "2014-01-01",
"include_lower" : true,
"include_upper" : true
}
}
}
}

Response

Search result 1 : {
"took" : 17,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "timestamp-id",
"_type" : "time-type",
"_id" : "1",
"_score" : 1.0, "_source" : {"field1":"value1"}
} ]
}
}

Regards,

Charles

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

If I run the following query (as described in the doc), I get an Error

curl -XGET 'http://localhost:9200/timestamp-id/_search?pretty=true' -d '

{
"fields" : [field1],
"query": {
"match_all": {}
}
}'
{
"error" : "SearchPhaseExecutionException[Failed to execute phase [query],
total failure; shardFailures {[IT1NrZfyRLSkABx7e05suA][timestamp-id][2]:
SearchParseException[[timestamp-id][2]: from[-1],size[-1]: Parse Failure
[Failed to parse source [\n{\n "fields" : [field1],\n "query": {\n
"match_all": {}\n }\n}]]]; nested: JsonParseException[Unrecognized
token 'field1': was expecting 'null', 'true', 'false' or NaN\n at [Source:
[B@6a58705f; line: 3, column: 22]];
}{[IT1NrZfyRLSkABx7e05suA][timestamp-id][1]:
SearchParseException[[timestamp-id][1]: from[-1],size[-1]: Parse Failure
[Failed to parse source [\n{\n "fields" : [field1],\n "query": {\n
"match_all": {}\n }\n}]]]; nested: JsonParseException[Unrecognized
token 'field1': was expecting 'null', 'true', 'false' or NaN\n at [Source:
[B@6a58705f; line: 3, column: 22]];
}{[IT1NrZfyRLSkABx7e05suA][timestamp-id][0]:
SearchParseException[[timestamp-id][0]: from[-1],size[-1]: Parse Failure
[Failed to parse source [\n{\n "fields" : [field1],\n "query": {\n
"match_all": {}\n }\n}]]]; nested: JsonParseException[Unrecognized
token 'field1': was expecting 'null', 'true', 'false' or NaN\n at [Source:
[B@6a58705f; line: 3, column: 22]]; }]",
"status" : 500

On Thursday, August 8, 2013 8:54:00 AM UTC+2, Charles Moulliard wrote:

Hi,

Is _timeStamp a kind of hidden field ? Why is this field not displayed in
the result (see hereafter response result) ?

Code

    XContentBuilder mapping = XContentFactory.jsonBuilder()
            .startObject()
              .startObject("time-type")
                .startObject("_timestamp")
                  .field("enabled", true)
                  .field("store", "yes")
                .endObject()
              .endObject()
            .endObject();

    client.admin().indices().prepareCreate("timestamp-id")
            .addMapping("time-type", mapping)
            .execute().actionGet();

    client.prepareIndex("timestamp-id", "time-type", "1")
       .setSource("field1", "value1")
       .setTimestamp("2013-01-01T00:00:00")
       .setRefresh(true).execute().actionGet();

    requestBuilder = client.prepareSearch("timestamp-id")

.setQuery(QueryBuilders.rangeQuery("_timestamp").gte("2012-01-01").lte("2014-01-01"));

    response = requestBuilder.execute().actionGet();

Query :

{
"query" : {
"range" : {
"_timestamp" : {
"from" : "2012-01-01",
"to" : "2014-01-01",
"include_lower" : true,
"include_upper" : true
}
}
}
}

Response

Search result 1 : {
"took" : 17,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "timestamp-id",
"_type" : "time-type",
"_id" : "1",
"_score" : 1.0, "_source" : {"field1":"value1"}
} ]
}
}

Regards,

Charles

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

field1 should be enclosed in quotes, if not the parser expects one of the
few JSON literals.

--
Ivan

On Thu, Aug 8, 2013 at 7:15 AM, Charles Moulliard ch007m@gmail.com wrote:

If I run the following query (as described in the doc), I get an Error

curl -XGET 'http://localhost:9200/timestamp-id/_search?pretty=true' -d '

{
"fields" : [field1],
"query": {
"match_all": {}
}
}'
{
"error" : "SearchPhaseExecutionException[Failed to execute phase
[query], total failure; shardFailures
{[IT1NrZfyRLSkABx7e05suA][timestamp-id][2]:
SearchParseException[[timestamp-id][2]: from[-1],size[-1]: Parse Failure
[Failed to parse source [\n{\n "fields" : [field1],\n "query": {\n
"match_all": {}\n }\n}]]]; nested: JsonParseException[Unrecognized
token 'field1': was expecting 'null', 'true', 'false' or NaN\n at [Source:
[B@6a58705f; line: 3, column: 22]];
}{[IT1NrZfyRLSkABx7e05suA][timestamp-id][1]:
SearchParseException[[timestamp-id][1]: from[-1],size[-1]: Parse Failure
[Failed to parse source [\n{\n "fields" : [field1],\n "query": {\n
"match_all": {}\n }\n}]]]; nested: JsonParseException[Unrecognized
token 'field1': was expecting 'null', 'true', 'false' or NaN\n at [Source:
[B@6a58705f; line: 3, column: 22]];
}{[IT1NrZfyRLSkABx7e05suA][timestamp-id][0]:
SearchParseException[[timestamp-id][0]: from[-1],size[-1]: Parse Failure
[Failed to parse source [\n{\n "fields" : [field1],\n "query": {\n
"match_all": {}\n }\n}]]]; nested: JsonParseException[Unrecognized
token 'field1': was expecting 'null', 'true', 'false' or NaN\n at [Source:
[B@6a58705f; line: 3, column: 22]]; }]",
"status" : 500

On Thursday, August 8, 2013 8:54:00 AM UTC+2, Charles Moulliard wrote:

Hi,

Is _timeStamp a kind of hidden field ? Why is this field not displayed in
the result (see hereafter response result) ?

Code

    XContentBuilder mapping = XContentFactory.jsonBuilder()
            .startObject()
              .startObject("time-type")
                .startObject("_timestamp")
                  .field("enabled", true)
                  .field("store", "yes")
                .endObject()
              .endObject()
            .endObject();

    client.admin().indices().**prepareCreate("timestamp-id")
            .addMapping("time-type", mapping)
            .execute().actionGet();

    client.prepareIndex("**timestamp-id", "time-type", "1")
       .setSource("field1", "value1")
       .setTimestamp("2013-01-01T00:**00:00")
       .setRefresh(true).execute().**actionGet();

    requestBuilder = client.prepareSearch("**timestamp-id")
            .setQuery(QueryBuilders.**rangeQuery("_timestamp").gte("*

*2012-01-01").lte("2014-01-01")**);

    response = requestBuilder.execute().**actionGet();

Query :

{
"query" : {
"range" : {
"_timestamp" : {
"from" : "2012-01-01",
"to" : "2014-01-01",
"include_lower" : true,
"include_upper" : true
}
}
}
}

Response

Search result 1 : {
"took" : 17,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "timestamp-id",
"_type" : "time-type",
"_id" : "1",
"_score" : 1.0, "_source" : {"field1":"value1"}
} ]
}
}

Regards,

Charles

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Been able to figure out my issue on my flight back

curl -XGET 'http://localhost:9200/timestamp-id/_search?pretty=true' -d '
{
"fields" : ["field1","_timestamp"],
"query" : {
"matchAll" : {}
}
}'

On Thursday, August 8, 2013 8:54:00 AM UTC+2, Charles Moulliard wrote:

Hi,

Is _timeStamp a kind of hidden field ? Why is this field not displayed in
the result (see hereafter response result) ?

Code

    XContentBuilder mapping = XContentFactory.jsonBuilder()
            .startObject()
              .startObject("time-type")
                .startObject("_timestamp")
                  .field("enabled", true)
                  .field("store", "yes")
                .endObject()
              .endObject()
            .endObject();

    client.admin().indices().prepareCreate("timestamp-id")
            .addMapping("time-type", mapping)
            .execute().actionGet();

    client.prepareIndex("timestamp-id", "time-type", "1")
       .setSource("field1", "value1")
       .setTimestamp("2013-01-01T00:00:00")
       .setRefresh(true).execute().actionGet();

    requestBuilder = client.prepareSearch("timestamp-id")

.setQuery(QueryBuilders.rangeQuery("_timestamp").gte("2012-01-01").lte("2014-01-01"));

    response = requestBuilder.execute().actionGet();

Query :

{
"query" : {
"range" : {
"_timestamp" : {
"from" : "2012-01-01",
"to" : "2014-01-01",
"include_lower" : true,
"include_upper" : true
}
}
}
}

Response

Search result 1 : {
"took" : 17,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "timestamp-id",
"_type" : "time-type",
"_id" : "1",
"_score" : 1.0, "_source" : {"field1":"value1"}
} ]
}
}

Regards,

Charles

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.