Array of strings vs string

Hi

i'd like to have a field in document to which i'm going to append
strings and use span_near queries to search for a specific sequence of
strings in it
i wonder if that kind of usage makes sense, and if using array of
strings instead of one long string would be better?

i.e.
which document is better for this kind of query

|
GET /my_index/_search
{
"query":{
"span_near":{
"clauses":[
{
"span_term":{
"seq":"lolrof"
}
}

,{
"span_multi":{
"match":{
"regexp":{"seq":"000200<0-20003>"}
}
}
}
],
"slop":100500,
"in_order":true
}
}
}

|

and this kind of update:

|
POST /my_index/4aeN2WBSS8WIpUpplUryPg/_update
{
"script":"ctx._source.seq += ['tag']"
}

|

documents:

|
POST /my_index
{
"seq":["lolrofl","000100010001","000200020002"]
}

|
POST /my_index
{
"seq":"lolrofl 000100010001 000200020002"
}

|
|

Thanks, Aleh

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/534E7D48.407%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Hello Aleh ,

Both should be good for your purpose.

But then if you want to match against "abc def" ( that is with the space)
tomorrow , the array type will alone help.
You can disable the analyzer for the field and achieve the functionality
which you cant if its a normal string.

Thanks
Vineeth

On Wed, Apr 16, 2014 at 6:23 PM, Aleh Aleshka oleglbch@gmail.com wrote:

Hi

i'd like to have a field in document to which i'm going to append strings
and use span_near queries to search for a specific sequence of strings in it
i wonder if that kind of usage makes sense, and if using array of strings
instead of one long string would be better?

i.e.
which document is better for this kind of query

GET /my_index/_search
{
"query": {
"span_near": {
"clauses": [
{
"span_term": {
"seq" : "lolrof"
}
}

    ,{
      "span_multi": {
        "match": {
          "regexp": {"seq" : "000200<0-20003>"}
        }
      }
    }
  ],
  "slop": 100500,
  "in_order": true
}

}
}

and this kind of update:

POST /my_index/4aeN2WBSS8WIpUpplUryPg/_update
{
"script" : "ctx._source.seq += ['tag']"
}

documents:

POST /my_index
{
"seq": ["lolrofl","000100010001","000200020002"]
}

POST /my_index
{
"seq": "lolrofl 000100010001 000200020002"
}

Thanks, Aleh

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/534E7D48.407%40gmail.comhttps://groups.google.com/d/msgid/elasticsearch/534E7D48.407%40gmail.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kFt0ABgY6P7%3Dae3z2fDXfByWEFjrPDzyAduXCMVA%3DQZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Thanks!

On Wednesday, April 16, 2014 6:39:00 PM UTC+3, vineeth mohan wrote:

Hello Aleh ,

Both should be good for your purpose.

But then if you want to match against "abc def" ( that is with the space)
tomorrow , the array type will alone help.
You can disable the analyzer for the field and achieve the functionality
which you cant if its a normal string.

Thanks
Vineeth

On Wed, Apr 16, 2014 at 6:23 PM, Aleh Aleshka <oleg...@gmail.com<javascript:>

wrote:

Hi

i'd like to have a field in document to which i'm going to append strings
and use span_near queries to search for a specific sequence of strings in it
i wonder if that kind of usage makes sense, and if using array of strings
instead of one long string would be better?

i.e.
which document is better for this kind of query

GET /my_index/_search
{
"query": {
"span_near": {
"clauses": [
{
"span_term": {
"seq" : "lolrof"
}
}

    ,{
      "span_multi": {
        "match": {
          "regexp": {"seq" : "000200<0-20003>"}
        }
      }
    }
  ],
  "slop": 100500,
  "in_order": true
}

}
}

and this kind of update:

POST /my_index/4aeN2WBSS8WIpUpplUryPg/_update
{
"script" : "ctx._source.seq += ['tag']"
}

documents:

POST /my_index
{
"seq": ["lolrofl","000100010001","000200020002"]
}

POST /my_index
{
"seq": "lolrofl 000100010001 000200020002"
}

Thanks, Aleh

--
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:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/534E7D48.407%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1fcaee3c-aa5b-4e59-8189-82ff46eb770f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Also have a read about position_offset_gap:

On 17 April 2014 14:42, Aleh Aleshka oleglbch@gmail.com wrote:

Thanks!

On Wednesday, April 16, 2014 6:39:00 PM UTC+3, vineeth mohan wrote:

Hello Aleh ,

Both should be good for your purpose.

But then if you want to match against "abc def" ( that is with the space)
tomorrow , the array type will alone help.
You can disable the analyzer for the field and achieve the functionality
which you cant if its a normal string.

Thanks
Vineeth

On Wed, Apr 16, 2014 at 6:23 PM, Aleh Aleshka oleg...@gmail.com wrote:

Hi

i'd like to have a field in document to which i'm going to append
strings and use span_near queries to search for a specific sequence of
strings in it
i wonder if that kind of usage makes sense, and if using array of
strings instead of one long string would be better?

i.e.
which document is better for this kind of query

GET /my_index/_search
{
"query": {
"span_near": {
"clauses": [
{
"span_term": {
"seq" : "lolrof"
}
}

    ,{
      "span_multi": {
        "match": {
          "regexp": {"seq" : "000200<0-20003>"}
        }
      }
    }
  ],
  "slop": 100500,
  "in_order": true
}

}
}

and this kind of update:

POST /my_index/4aeN2WBSS8WIpUpplUryPg/_update
{
"script" : "ctx._source.seq += ['tag']"
}

documents:

POST /my_index
{
"seq": ["lolrofl","000100010001","000200020002"]
}

POST /my_index
{
"seq": "lolrofl 000100010001 000200020002"
}

Thanks, Aleh

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

To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/534E7D48.407%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/1fcaee3c-aa5b-4e59-8189-82ff46eb770f%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/1fcaee3c-aa5b-4e59-8189-82ff46eb770f%40googlegroups.com?utm_medium=email&utm_source=footer
.

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

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAPt3XKSeQ3p%2B%2BQSpTDma4M1kzt2BGJEDUJq_3GZRR0_XEjmFYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.