After inserting the following document:
curl -XPOST 'localhost:9200/twitter/tweet/1' -d ' { "f1":"abc","f3":"ghi" }'
I discovered that I can search it four ways:
curl -XGET 'localhost:9200/twitter/_search?q=f1=abc'
curl -XGET 'localhost:9200/twitter/tweet/_search?q=f1=abc'
curl -XGET 'localhost:9200/twitter/tweet/_search?q=tweet.f1=abc'
curl -XGET 'localhost:9200/twitter/_search?q=tweet.f1=abc'
So, in trying to get my head around just what a type is, I see that I must
specify the type when I insert the document. For example, the following
doesn't work:
curl -XPOST 'localhost:9200/twitter/' -d ' { "a": "val" } '
However, I can include the type with the data when inserting:
curl -XPOST 'localhost:9200/twitter/tweet/2' -d ' { "tweet": {
"f1":"abc","f3":"ghi" } }'
So, are documents 1 and 2 indexed exactly the same? Are there any
advantages to indexing and searching with and without the type? The only
difference I see is that the _source field appears to store the document
exactly as it is entered, so that doc 1 is returned as: {
"f1":"abc","f3":"ghi" } and doc 2 is returned as: { "tweet": {
"f2":"def","f3":"ghi" } }
Thank you for any recommendations and insight.
--
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.