( Multimatch && Term ) in should

Hello,

I begin in ElasticSearch 0.9 and I try to make a query including a
multi_match and search term in should.

I have many post with content, title, tags and ( author or creator).

I want search all post for an user for a word.

"should":
{
"multi_match": {
"query": "test",
"type": "phrase",
"slop": 4,
"fields": [
"title",
"content",
"tags"
] }
}

If the search find a comment with "test", authorId must be the id in param.
But it can't be in must node sibling of this should.
The AND operator must be in the should.

In SQL it's like that :
WHERE group = 1
AND
(
title LIKE "%test%"
OR
content LIKE "%test%"
OR
tags LIKE "%test%"
)
AND
(
authorId = 1
OR
creatorId = 1
)

group = 1 it's in the MUST
the other in SHOULD

How can I do ?

Best regards

Aurelien

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

Hi there,

I wrote a gist here. I think it's somehow what you are looking for: https://gist.github.com/dadoonet/7374452

Hope this helps

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

8 novembre 2013 at 17:41:17, apl@bluekiwi-software.com (apl@bluekiwi-software.com) a écrit:

Hello,

I begin in ElasticSearch 0.9 and I try to make a query including a multi_match and search term in should.

I have many post with content, title, tags and ( author or creator).

I want search all post for an user for a word.

"should":
{
"multi_match": {
"query": "test",
"type": "phrase",
"slop": 4,
"fields": [
"title",
"content",
"tags"
] }
}

If the search find a comment with "test", authorId must be the id in param. But it can't be in must node sibling of this should.
The AND operator must be in the should.

In SQL it's like that :
WHERE group = 1
AND
(
title LIKE "%test%"
OR
content LIKE "%test%"
OR
tags LIKE "%test%"
)
AND
(
authorId = 1
OR
creatorId = 1
)

group = 1 it's in the MUST
the other in SHOULD

How can I do ?

Best regards

Aurelien

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.

Thank you for your help.

Your response has open my mind about possibilities with ES query including
AND and OR =)
You have resolved lot of questions about this for me.

Aurelien

On Friday, November 8, 2013 6:23:18 PM UTC+1, David Pilato wrote:

Hi there,

I wrote a gist here. I think it's somehow what you are looking for:
Bluekiwi example · GitHub

Hope this helps

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr

8 novembre 2013 at 17:41:17, a...@bluekiwi-software.com <javascript:> (
a...@bluekiwi-software.com <javascript:>) a écrit:

Hello,

I begin in Elasticsearch 0.9 and I try to make a query including a
multi_match and search term in should.

I have many post with content, title, tags and ( author or creator).

I want search all post for an user for a word.

"should":
{
"multi_match": {
"query": "test",
"type": "phrase",
"slop": 4,
"fields": [
"title",
"content",
"tags"
] }
}

If the search find a comment with "test", authorId must be the id in
param. But it can't be in must node sibling of this should.
The AND operator must be in the should.

In SQL it's like that :
WHERE group = 1
AND
(
title LIKE "%test%"
OR
content LIKE "%test%"
OR
tags LIKE "%test%"
)
AND
(
authorId = 1
OR
creatorId = 1
)

group = 1 it's in the MUST
the other in SHOULD

How can I do ?

Best regards

Aurelien

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