Mapping Index with Specific Field with CouchbaseDocument

Hello All,

I have created template for mapping index. I want to map specific filed to
index. I dont want all filed. Please find below command.

curl -XPUT http://localhost:9200/fact/Activity/_mapping -d " {"Activity"
: {

"_all" : { "enabled" : false}, "_source": { "compress": false },

"properties" : {"ActiveUser" : {"type" : "string", "store" :
"yes"},

"ActiveOrganization" : {"type" : "string", "store" : "yes"}}}}

In this i have added two field like ActiveUser and Activeorganization into
fact Index. But when I push data form coucbase then it mapped all fileds
with same index.I have set _all filed to false but its not working. I have
also attched image please check it.

Before push data from coucbase it looks as below. I want only two fields
like as below

JSON format for mapping which is as below.

After push data from couchbase it mapped all fields with index which is as
below. I dont want this? How to disable all fileds?

Please help me for same.
Quick response will be appreciable

Thanks
Suraj Bhansali

On Wed, Mar 13, 2013 at 11:56 AM, kuwar sahani kuwarsahani@gmail.comwrote:

Hi

I've created the following Index and mapping :

Index : curl -XPUT 'http://10.118.192.165:9200/matches'

Mapping:

curl -XPUT 'http://10.118.192.165:9200/matches/tags_nested/_mapping' -d '
{
"tags_nested":{
"properties":{
"name": {
"type": "string"
},
"total_runs": {
"type": "integer"
},
"matches_played": {
"type": "string"
},
"highest_score": {
"type": "string"
},
"tags": {
"type" : "nested"
}

}
}
}'

the data inserted is :

curl XPUT 'http://10.118.192.165:9200/matches/tags_nested/1' -d'
{
"name" : "sachin",
"total_runs" : "500",
"matches_played" : "4",
"highest_score" : "200*",
"tags" :[
{
"user" : "kuwar",
"tag" : "master blaster"
},
{
"user" : "nipun",
"tag" : "world class"
},
{
"user" : "mayank",
"tag" : "200 not out"
}
]

}'

curl XPUT 'http://10.118.192.165:9200/matches/tags_nested/2' -d'
{
"name" : "hayden",
"total_runs" : "300",
"matches_played" : "4",
"highest_score" : "110",
"tags" :[
{
"user" : "kuwar",
"tag" : "good knock"
},
{
"user" : "nipun",
"tag" : "match winning"
}
]

}'

I want to find the record where the user "kuwar" has a tag "master
blaster" . Have designed the following query but it does not give me the
result.

curl -XGET '
http://10.118.192.165:9200/matches/tags_nested/_search?pretty=true' -d '
{
"query": {
"nested": {
"path": "tags",
"query":{
"filtered": {
"query": { "match_all": {}},
"filter": {
"and": [
{"term": {"tags.user": "kuwar"}},
{"term": {"tags.tag": "master blaster"}}
]
}
}
}
}
}
}'

the query does not give me the result. however if i change tags.tag to
"master" instead of "master blaster" the output comes.

how to solve this problem ?
thanks in advance.

--
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.

Elasticsearch stores your document source as is in the _source field. It does not remove anything.

So you have to remove fields you don't want before sending the document to Elasticsearch.
You can also create a template saying that you don't want source and that all other fields are not stored and indexed.

But, main question is why do you want to remove some parts of your doc?

Does it help?

David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 13 mars 2013 à 08:27, Suraj Bhansali bhansalisuraj@gmail.com a écrit :

Hello All,

I have created template for mapping index. I want to map specific filed to index. I dont want all filed. Please find below command.

curl -XPUT http://localhost:9200/fact/Activity/_mapping -d " {"Activity" : {

"_all" : { "enabled" : false}, "_source": { "compress": false },

"properties" : {"ActiveUser" : {"type" : "string", "store" : "yes"},

"ActiveOrganization" : {"type" : "string", "store" : "yes"}}}}

In this i have added two field like ActiveUser and Activeorganization into fact Index. But when I push data form coucbase then it mapped all fileds with same index.I have set _all filed to false but its not working. I have also attched image please check it.

Before push data from coucbase it looks as below. I want only two fields like as below

JSON format for mapping which is as below.

After push data from couchbase it mapped all fields with index which is as below. I dont want this? How to disable all fileds?

Please help me for same.
Quick response will be appreciable

Thanks
Suraj Bhansali

On Wed, Mar 13, 2013 at 11:56 AM, kuwar sahani kuwarsahani@gmail.com wrote:

Hi

I've created the following Index and mapping :

Index : curl -XPUT 'http://10.118.192.165:9200/matches'

Mapping:

curl -XPUT 'http://10.118.192.165:9200/matches/tags_nested/_mapping' -d '
{
"tags_nested":{
"properties":{
"name": {
"type": "string"
},
"total_runs": {
"type": "integer"
},
"matches_played": {
"type": "string"
},
"highest_score": {
"type": "string"
},
"tags": {
"type" : "nested"
}

}
}
}'

the data inserted is :

curl XPUT 'http://10.118.192.165:9200/matches/tags_nested/1' -d'
{
"name" : "sachin",
"total_runs" : "500",
"matches_played" : "4",
"highest_score" : "200*",
"tags" :[
{
"user" : "kuwar",
"tag" : "master blaster"
},
{
"user" : "nipun",
"tag" : "world class"
},
{
"user" : "mayank",
"tag" : "200 not out"
}
]

}'

curl XPUT 'http://10.118.192.165:9200/matches/tags_nested/2' -d'
{
"name" : "hayden",
"total_runs" : "300",
"matches_played" : "4",
"highest_score" : "110",
"tags" :[
{
"user" : "kuwar",
"tag" : "good knock"
},
{
"user" : "nipun",
"tag" : "match winning"
}
]

}'

I want to find the record where the user "kuwar" has a tag "master blaster" . Have designed the following query but it does not give me the result.

curl -XGET 'http://10.118.192.165:9200/matches/tags_nested/_search?pretty=true' -d '
{
"query": {
"nested": {
"path": "tags",
"query":{
"filtered": {
"query": { "match_all": {}},
"filter": {
"and": [
{"term": {"tags.user": "kuwar"}},
{"term": {"tags.tag": "master blaster"}}
]
}
}
}
}
}
}'

the query does not give me the result. however if i change tags.tag to "master" instead of "master blaster" the output comes.

how to solve this problem ?
thanks in advance.

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.

--
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 dadoonet,

Thanks for quick reply,

I have created template that source was disabled but other fields are stored
and indexed still. I dont want to remove doc, I want only specific field
with value from this doc. And those fields will be available into Field list
in Elastic Search cluster. I have created template with those field and they
are added into list. But when I push data from couchbase to elastic search
then it added all fields.

Can you please let me now some steps for create template for same.

Thanks
Suraj Bhansali

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Mapping-Index-with-Specific-Field-with-CouchbaseDocument-tp4031551p4031562.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

--
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 dadoonet,

Thanks for quick reply,

I have created template that source was disabled but other fields are
stored and indexed still. I don't want to remove doc, I want only specific
field with value from this doc. And those fields will be available into
Field list in Elastic Search cluster. I have created template with those
field and they are added into list. But when I push data from couchbase to
Elasticsearch then it added all fields.

Can you please let me now some steps for create template for same.

On Wednesday, 13 March 2013 12:57:35 UTC+5:30, bhansalisuraj wrote:

Hello All,

I have created template for mapping index. I want to map specific filed to
index. I dont want all filed. Please find below command.

curl -XPUT http://localhost:9200/fact/Activity/_mapping -d "
{"Activity" : {

"_all" : { "enabled" : false}, "_source": { "compress": false },

"properties" : {"ActiveUser" : {"type" : "string", "store" :
"yes"},

"ActiveOrganization" : {"type" : "string", "store" : "yes"}}}}

In this i have added two field like ActiveUser and Activeorganization into
fact Index. But when I push data form coucbase then it mapped all fileds
with same index.I have set _all filed to false but its not working. I have
also attched image please check it.

Before push data from coucbase it looks as below. I want only two fields
like as below

JSON format for mapping which is as below.

After push data from couchbase it mapped all fields with index which is as
below. I dont want this? How to disable all fileds?

Please help me for same.
Quick response will be appreciable

Thanks
Suraj Bhansali

On Wed, Mar 13, 2013 at 11:56 AM, kuwar sahani kuwarsahani@gmail.comwrote:

Hi

I've created the following Index and mapping :

Index : curl -XPUT 'http://10.118.192.165:9200/matches'

Mapping:

curl -XPUT 'http://10.118.192.165:9200/matches/tags_nested/_mapping' -d '
{
"tags_nested":{
"properties":{
"name": {
"type": "string"
},
"total_runs": {
"type": "integer"
},
"matches_played": {
"type": "string"
},
"highest_score": {
"type": "string"
},
"tags": {
"type" : "nested"
}

}
}
}'

the data inserted is :

curl XPUT 'http://10.118.192.165:9200/matches/tags_nested/1' -d'
{
"name" : "sachin",
"total_runs" : "500",
"matches_played" : "4",
"highest_score" : "200*",
"tags" :[
{
"user" : "kuwar",
"tag" : "master blaster"
},
{
"user" : "nipun",
"tag" : "world class"
},
{
"user" : "mayank",
"tag" : "200 not out"
}
]

}'

curl XPUT 'http://10.118.192.165:9200/matches/tags_nested/2' -d'
{
"name" : "hayden",
"total_runs" : "300",
"matches_played" : "4",
"highest_score" : "110",
"tags" :[
{
"user" : "kuwar",
"tag" : "good knock"
},
{
"user" : "nipun",
"tag" : "match winning"
}
]

}'

I want to find the record where the user "kuwar" has a tag "master
blaster" . Have designed the following query but it does not give me the
result.

curl -XGET '
http://10.118.192.165:9200/matches/tags_nested/_search?pretty=true' -d '
{
"query": {
"nested": {
"path": "tags",
"query":{
"filtered": {
"query": { "match_all": {}},
"filter": {
"and": [
{"term": {"tags.user": "kuwar"}},
{"term": {"tags.tag": "master blaster"}}
]
}
}
}
}
}
}'

the query does not give me the result. however if i change tags.tag to
"master" instead of "master blaster" the output comes.

how to solve this problem ?
thanks in advance.

--
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.