Nested documents search

All,

I have nested documents with the following structure

rtext :
{
id : integer,
value : string
}

rdata
{
id : integer.
value : float
}

I'm trying to search all the documents with id = 1 and value = xxx

{
"filter": {
"nested": {
"path": "rtext",
"query": {
"bool": {
"must": [
{
"term": {
"rtext.textmapid": "1"
}
},
{
"term": {
"rtext.textvalue": "xxx"
}
}
]
}
}
}
}
}

The query returns 0 results. But If the ran the same rdata which has value
type as float it comes back with results. Am I missing anything ?

Thanks,
Abhishek

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

Hey,

can you maybe provide a full minimal example including mapping, indexing
data and full queries. This would allow other people to reproduce your
issue easily and see what is wrong. Also including the case where
everything works, would be useful.

Thanks!

--Alex

On Mon, Aug 12, 2013 at 11:05 PM, Abhishek Andhavarapu <
abhishek376@gmail.com> wrote:

All,

I have nested documents with the following structure

rtext :
{
id : integer,
value : string
}

rdata
{
id : integer.
value : float
}

I'm trying to search all the documents with id = 1 and value = xxx

{
"filter": {
"nested": {
"path": "rtext",
"query": {
"bool": {
"must": [
{
"term": {
"rtext.textmapid": "1"
}
},
{
"term": {
"rtext.textvalue": "xxx"
}
}
]
}
}
}
}
}

The query returns 0 results. But If the ran the same rdata which has value
type as float it comes back with results. Am I missing anything ?

Thanks,
Abhishek

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

Alex,

Thanks for the reply.

My Mappings
{
"response": {
"properties": {
"rtext": {
"type": "nested",
"properties": {
"textmapid": {
"type": "integer"
},
"textvalue": {
"type": "string"
}
}
}
}
}
}

Sample data

{
"rtext" : [
{
"textmapid" : 1,
"textvalue" : "Jennifer"
},
{
"textmapid" : 2,
"textvalue" : "Adam"
}
]
}

My query

Term filter does not work.

{
"filter": {
"nested": {
"path": "rtext",
"query": {
"bool": {
"must": [
{
"term": {
"rtext.textvalue": "Jennifer"
}
},
{
"term": {
"rtext.textmapid": 1
}
}
]
}
}
}
}
}

Match filter works
{
"filter": {
"nested": {
"path": "rtext",
"query": {
"bool": {
"must": [
{
"match": {
"rtext.textvalue": "Jennifer"
}
},
{
"term": {
"rtext.textmapid": 1
}
}
]
}
}
}
}
}

Prefix filter doesn't work but match_phrase_prefix works.

1)Term filter doesn't work but match filter works why ?
2) Prefix filter doesn't work but match_phrase_prefix works. What the
difference between match and match_phrase ?
3) How do I write a begins with and ends with filter ? I tried regex filter
with "Jen." and \bJen(.)\b for begins with it didnot work ?
4) How do I write a exists and missing filter they dont work either.

{
"filter": {
"nested": {
"path": "rtext",
"query": {
"bool": {
"must": [
{
"exists": {
"field": "rtext.textvalue"
}
},
{
"term": {
"rtext.textmapid": 1
}
}
]
}
}
}
}
}

Thanks,
Abhishek

On Tue, Aug 13, 2013 at 12:54 AM, Alexander Reelsen alr@spinscale.dewrote:

Hey,

can you maybe provide a full minimal example including mapping, indexing
data and full queries. This would allow other people to reproduce your
issue easily and see what is wrong. Also including the case where
everything works, would be useful.

Thanks!

--Alex

On Mon, Aug 12, 2013 at 11:05 PM, Abhishek Andhavarapu <
abhishek376@gmail.com> wrote:

All,

I have nested documents with the following structure

rtext :
{
id : integer,
value : string
}

rdata
{
id : integer.
value : float
}

I'm trying to search all the documents with id = 1 and value = xxx

{
"filter": {
"nested": {
"path": "rtext",
"query": {
"bool": {
"must": [
{
"term": {
"rtext.textmapid": "1"
}
},
{
"term": {
"rtext.textvalue": "xxx"
}
}
]
}
}
}
}
}

The query returns 0 results. But If the ran the same rdata which has
value type as float it comes back with results. Am I missing anything ?

Thanks,
Abhishek

--
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 a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/zIqeV_yjG2A/unsubscribe.
To unsubscribe from this group and all its topics, 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.

1)Term filter doesn't work but match filter works why ?

Because term filter doesn't analyze the search string and match filter
does. There is not token "Jennifer" in your index, only "jennifer".

  1. Prefix filter doesn't work but match_phrase_prefix works. What the
    difference between match and match_phrase ?

See 1)

  1. How do I write a begins with and ends with filter ? I tried regex filter
    with "Jen." and \bJen(.)\b for begins with it didnot work ?

You might be better using EdgeNGrams here, but at least lowercase your term.

  1. How do I write a exists and missing filter they dont work either.

exists is a filter (not query) so it should be:

{
"filter": {
"nested": {
"path": "rtext",

  •  "filter": {*
      "bool": {
        "must": [
          {
            "exists": {
              "field": "rtext.textvalue"
            }
          },
          {
            "term": {
              "rtext.textmapid": 1
            }
          }
        ]
      }
    }
    
    }
    }
    }

On Tuesday, August 13, 2013 5:04:38 PM UTC-4, Abhishek Andhavarapu wrote:

Alex,

Thanks for the reply.

My Mappings
{
"response": {
"properties": {
"rtext": {
"type": "nested",
"properties": {
"textmapid": {
"type": "integer"
},
"textvalue": {
"type": "string"
}
}
}
}
}
}

Sample data

{
"rtext" : [
{
"textmapid" : 1,
"textvalue" : "Jennifer"
},
{
"textmapid" : 2,
"textvalue" : "Adam"
}
]
}

My query

Term filter does not work.

{
"filter": {
"nested": {
"path": "rtext",
"query": {
"bool": {
"must": [
{
"term": {
"rtext.textvalue": "Jennifer"
}
},
{
"term": {
"rtext.textmapid": 1
}
}
]
}
}
}
}
}

Match filter works
{
"filter": {
"nested": {
"path": "rtext",
"query": {
"bool": {
"must": [
{
"match": {
"rtext.textvalue": "Jennifer"
}
},
{
"term": {
"rtext.textmapid": 1
}
}
]
}
}
}
}
}

Prefix filter doesn't work but match_phrase_prefix works.

1)Term filter doesn't work but match filter works why ?
2) Prefix filter doesn't work but match_phrase_prefix works. What the
difference between match and match_phrase ?
3) How do I write a begins with and ends with filter ? I tried regex
filter with "Jen." and \bJen(.)\b for begins with it didnot work ?
4) How do I write a exists and missing filter they dont work either.

{
"filter": {
"nested": {
"path": "rtext",
"query": {
"bool": {
"must": [
{
"exists": {
"field": "rtext.textvalue"
}
},
{
"term": {
"rtext.textmapid": 1
}
}
]
}
}
}
}
}

Thanks,
Abhishek

On Tue, Aug 13, 2013 at 12:54 AM, Alexander Reelsen <a...@spinscale.de<javascript:>

wrote:

Hey,

can you maybe provide a full minimal example including mapping, indexing
data and full queries. This would allow other people to reproduce your
issue easily and see what is wrong. Also including the case where
everything works, would be useful.

Thanks!

--Alex

On Mon, Aug 12, 2013 at 11:05 PM, Abhishek Andhavarapu <
abhis...@gmail.com <javascript:>> wrote:

All,

I have nested documents with the following structure

rtext :
{
id : integer,
value : string
}

rdata
{
id : integer.
value : float
}

I'm trying to search all the documents with id = 1 and value = xxx

{
"filter": {
"nested": {
"path": "rtext",
"query": {
"bool": {
"must": [
{
"term": {
"rtext.textmapid": "1"
}
},
{
"term": {
"rtext.textvalue": "xxx"
}
}
]
}
}
}
}
}

The query returns 0 results. But If the ran the same rdata which has
value type as float it comes back with results. Am I missing anything ?

Thanks,
Abhishek

--
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 elasticsearc...@googlegroups.com <javascript:>.

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

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/zIqeV_yjG2A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearc...@googlegroups.com <javascript:>.
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.