Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using parent property in update API with doc_as_upsert=true does not work #3444

Closed
poorvamandar opened this Issue Aug 5, 2013 · 5 comments

Comments

Projects
None yet
2 participants
@poorvamandar
Copy link

commented Aug 5, 2013

If I try to add a document using the bulk update API (doc_as_upsert=true) and set its parent property, I do not see the document as the child of the specified parent when I make a has_parent query. Can you please help see what could be wrong with the below. Thanks in advance.

Following is the mapping:

mappings: {
store: {
properties: {
name: {
type: string
}
owner: {
type: string
}
}
}
department: {
_routing: {
required: true
}
properties: {
name: {
type: string
}
numberOfProducts: {
type: long
}
}
_parent: {
type: store
}
}
}

Following is the bulk input file:

{ "index" : { "_index" : "parent_child", "_type" : "store", "_id" : "store1" } }
{ "name" : "auchan", "owner" : "chris" }
{ "index" : { "_index" : "parent_child", "_type" : "department", "_id" : "department1", "parent" : "store1" } }
{ "name" : "toys", "numberOfProducts" : 150 }
{ "update" : { "_index" : "parent_child", "_type" : "department", "_id" : "department2", "parent" : "store1" } }
{"doc" : { "name" : "dolls", "numberOfProducts" : 300 }, "doc_as_upsert" : "true"}

Query -

{
"query": {
"has_parent": {
"type": "store",
"query": {
"match_all": {}
}
}
}
}

@ghost ghost assigned javanna Aug 5, 2013

@javanna javanna closed this in 636c35d Aug 6, 2013

javanna added a commit that referenced this issue Aug 6, 2013

Added missing metadata fields to upserted documents (parent, routing,…
… ttl, timestamp, version and versionType)

Closes #3444
@javanna

This comment has been minimized.

Copy link
Member

commented Aug 6, 2013

A small note: found and fixed the same issue on upserts (slightly different from doc_as_upsert case)

@poorvamandar

This comment has been minimized.

Copy link
Author

commented Aug 8, 2013

Thanks much for the quick fix!

@poorvamandar

This comment has been minimized.

Copy link
Author

commented Aug 8, 2013

Hi Luca - is there a nightly build that I can use to get this fix? Or will I have to do my own build?

@javanna

This comment has been minimized.

Copy link
Member

commented Aug 9, 2013

@poorvamandar the fix was released with 0.90.3, no need for any nightly build, just download the latest version of elasticsearch ;)

@poorvamandar

This comment has been minimized.

Copy link
Author

commented Aug 9, 2013

Ah, thanks Luca!

mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.